openapi: 3.0.3
info:
  title: Ativos Admin
  version: v1.0.0
  description: |
    Endpoints administrativos para gestão de Ativos do Site (contratos_site_ativos) por contrato.
servers:
  - url: /adm/api
tags:
  - name: AtivosAdmin
paths:
  /AtivosAdmin/list:
    post:
      tags: [AtivosAdmin]
      summary: Listagem server-side (DataTables)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                draw: { type: integer, example: 1 }
                start: { type: integer, example: 0 }
                length: { type: integer, example: 25 }
                search:
                  type: object
                  properties:
                    value: { type: string, example: "" }
                order:
                  type: array
                  items:
                    type: object
                    properties:
                      column: { type: integer, example: 7 }
                      dir: { type: string, example: "asc" }
                contrato: { type: integer, example: 38 }
                q: { type: string, example: "" }
                tipo: { type: string, example: "banner" }
                area: { type: string, example: "home_topo" }
                status:
                  oneOf:
                    - type: string
                    - type: integer
                  example: "1"
      responses:
        "200":
          description: OK

  /AtivosAdmin/get:
    post:
      tags: [AtivosAdmin]
      summary: Carrega 1 ativo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id: { type: integer, example: 12 }
      responses:
        "200":
          description: OK

  /AtivosAdmin/save:
    post:
      tags: [AtivosAdmin]
      summary: Cria/edita ativo (schema completo)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id: { type: integer, example: 0 }
                contrato: { type: integer, example: 38 }
                planos:
                  oneOf:
                    - type: string
                    - type: array
                      items: { type: integer }
                  example: "12,13"
                media: { type: string, example: "https://..." }
                tipo: { type: string, example: "banner" }
                dispositivos: { type: string, example: "desktop,mobile" }
                titulo: { type: string, example: "Hero topo" }
                texto_alternativo: { type: string, example: "Banner" }
                legenda: { type: string, example: "Legenda" }
                descricao: { type: string, example: "<p>HTML...</p>" }
                alinhamento:
                  type: string
                  enum: [Nenhum, Esquerda, Direita, Centro]
                  example: Centro
                apontamento:
                  type: string
                  enum: [Nenhum, Arquivo, URL]
                  example: URL
                label: { type: string, example: "Saiba mais" }
                destino:
                  type: string
                  enum: [_self, _blank]
                  example: _blank
                url: { type: string, example: "https://..." }
                area: { type: string, example: "home_topo" }
                status: { type: integer, example: 1 }
                ocultar_titulo: { type: integer, example: 1 }
                ordem: { type: integer, example: 1 }
                tamanho_desktop: { type: string, example: "col-12" }
                tamanho_mobile: { type: string, example: "col-12" }
                cor_padrao: { type: string, example: "#871312" }
                largura_total: { type: integer, example: 0 }
                css: { type: string, example: ".meu-css{...}" }
                fundo_imagem: { type: string, example: "https://..." }
                fundo_imagem_tamanho: { type: string, example: "cover" }
                fundo_imagem_repetir: { type: string, example: "no-repeat" }
                fundo_imagem_anexo: { type: string, example: "" }
                fundo_imagem_posicao: { type: string, example: "center" }
                tipo_borda: { type: string, example: "solid" }
                borda_superior: { type: integer, example: 0 }
                borda_direita: { type: integer, example: 0 }
                borda_inferior: { type: integer, example: 0 }
                borda_esquerda: { type: integer, example: 0 }
                cor_borda: { type: string, example: "#e5e7eb" }
                arredondamento_superior: { type: integer, example: 0 }
                arredondamento_direita: { type: integer, example: 0 }
                arredondamento_inferior: { type: integer, example: 0 }
                arredondamento_esquerda: { type: integer, example: 0 }
                layout: { type: string, example: "<div>...</div>" }
                classe_css: { type: string, example: "minha-classe" }
                id_css: { type: string, example: "hero-topo" }
                zindex: { type: integer, example: 10 }
                efeito_json: { type: string, example: "{\"fx\":true}" }
      responses:
        "200":
          description: OK

  /AtivosAdmin/delete:
    post:
      tags: [AtivosAdmin]
      summary: Exclui 1 ativo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id: { type: integer, example: 12 }
      responses:
        "200":
          description: OK

  /AtivosAdmin/batch_activate:
    post:
      tags: [AtivosAdmin]
      summary: Ativa em lote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items: { type: integer }
                  example: [12, 13, 14]
      responses:
        "200":
          description: OK

  /AtivosAdmin/batch_deactivate:
    post:
      tags: [AtivosAdmin]
      summary: Desativa em lote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items: { type: integer }
                  example: [12, 13, 14]
      responses:
        "200":
          description: OK

  /AtivosAdmin/batch_delete:
    post:
      tags: [AtivosAdmin]
      summary: Exclui em lote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items: { type: integer }
                  example: [12, 13, 14]
      responses:
        "200":
          description: OK

  /AtivosAdmin/reorder:
    post:
      tags: [AtivosAdmin]
      summary: Reordena ativos (ordem por array)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contrato: { type: integer, example: 38 }
                ids:
                  type: array
                  items: { type: integer }
                  example: [14, 12, 13]
      responses:
        "200":
          description: OK