openapi: 3.0.3
info:
  title: Contrato Site Admin
  version: v1.0.0
  description: |
    Endpoints administrativos para gestão de configurações do site por contrato (tabela contratos_site).
servers:
  - url: /adm/api
tags:
  - name: ContratoSiteAdmin

paths:
  /ContratoSiteAdmin/get:
    post:
      tags: [ContratoSiteAdmin]
      summary: Carrega (e garante existência) do registro de site do contrato
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id_contrato: { type: integer, example: 38 }
      responses:
        "200":
          description: OK

  /ContratoSiteAdmin/save:
    post:
      tags: [ContratoSiteAdmin]
      summary: Salva configurações do site do contrato (filtra por colunas existentes)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id: { type: integer, example: 0 }
                id_contrato: { type: integer, example: 38 }
                header_sticky: { type: integer, example: 1 }
                top_bar: { type: integer, example: 0 }
                ocultar_beneficios: { type: integer, example: 0 }
                ocultar_planos: { type: integer, example: 0 }
                beneficios_descricao: { type: integer, example: 1 }
                beneficios_carrossel: { type: integer, example: 0 }
                beneficios_home:
                  oneOf:
                    - type: string
                    - type: array
                  example: "[1,2,3]"
                banner_texto_dir: { type: string, example: "<p>HTML…</p>" }
                css: { type: string, example: "body{...}" }
                js_header: { type: string, example: "console.log('x')" }
                js_footer: { type: string, example: "console.log('y')" }
      responses:
        "200":
          description: OK

  /ContratoSiteAdmin/clear_field:
    post:
      tags: [ContratoSiteAdmin]
      summary: Limpa um campo específico do contratos_site
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id_contrato: { type: integer, example: 38 }
                field: { type: string, example: "favicon" }
      responses:
        "200":
          description: OK