openapi: 3.0.3
info:
  title: Changelogs API
  version: v1.0.0
  description: |
    Endpoints do módulo de changelogs para gestão administrativa,
    feed interno e feed público.
servers:
  - url: /adm/api
tags:
  - name: Changelogs
    description: Gestão, consulta e publicação de changelogs

paths:
  /Changelogs/dashboard:
    get:
      tags: [Changelogs]
      summary: Dashboard administrativo de changelogs
      responses:
        "200":
          description: OK

  /Changelogs/feed:
    get:
      tags: [Changelogs]
      summary: Feed interno de changelogs
      responses:
        "200":
          description: OK

  /Changelogs/feedMine:
    get:
      tags: [Changelogs]
      summary: Feed dos changelogs do usuário atual
      responses:
        "200":
          description: OK

  /Changelogs/feedPublic:
    get:
      tags: [Changelogs]
      summary: Feed público de changelogs publicados
      responses:
        "200":
          description: OK

  /Changelogs/get:
    get:
      tags: [Changelogs]
      summary: Buscar changelog interno por id
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: integer
            example: 10
      responses:
        "200":
          description: OK

  /Changelogs/getPublic:
    get:
      tags: [Changelogs]
      summary: Buscar changelog público por id
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: integer
            example: 10
      responses:
        "200":
          description: OK

  /Changelogs/saveText:
    post:
      tags: [Changelogs]
      summary: Criar changelog a partir de markdown colado
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [conteudo]
              properties:
                titulo:
                  type: string
                  example: Ajustes no módulo de tickets
                conteudo:
                  type: string
                  example: "# Ajustes no módulo de tickets"
                visivel_cliente:
                  type: integer
                  enum: [0, 1]
                  example: 1
                persist_docs:
                  type: integer
                  enum: [0, 1]
                  example: 1
                  description: Quando informado com `1`, tambem grava o markdown em `docs/changelogs`.
      responses:
        "200":
          description: OK

  /Changelogs/upload:
    post:
      tags: [Changelogs]
      summary: Importar changelogs por arquivo
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files[]:
                  type: string
                  format: binary
                titulo:
                  type: string
                  example: Entrega de integração
                visivel_cliente:
                  type: integer
                  enum: [0, 1]
                  example: 0
                persist_docs:
                  type: integer
                  enum: [0, 1]
                  example: 1
                  description: Quando informado com `1`, copia o markdown importado para `docs/changelogs`.
      responses:
        "200":
          description: OK

  /Changelogs/togglePublic:
    post:
      tags: [Changelogs]
      summary: Alternar visibilidade pública do changelog
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [id]
              properties:
                id:
                  type: integer
                  example: 10
      responses:
        "200":
          description: OK

  /Changelogs/delete:
    post:
      tags: [Changelogs]
      summary: Excluir changelog
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [id]
              properties:
                id:
                  type: integer
                  example: 10
      responses:
        "200":
          description: OK

  /Changelogs/createTicket:
    post:
      tags: [Changelogs]
      summary: Gerar ticket interno a partir do changelog
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [id]
              properties:
                id:
                  type: integer
                  example: 10
      responses:
        "200":
          description: OK
