openapi: "3.0.0"
info:
  version: 5.0.16
  title: JAGA
  license:
    name: MIT
servers:
  - url: https://bima.kpk.go.id/api/v5
  - url: https://jaga.id/api/v5
paths:
  /lapor:
    get:
      x-frapp-permission: moderate-report
      summary: Daftar laporan diskusi untuk halaman administrator
      operationId: listReport
      tags:
        - Lapor
      parameters:
        - name: limit
          in: query
          description: Jumlah item yang diminta pada satu request
          required: false
          schema:
            type: integer
            format: int32
        - name: offset
          in: query
          description: Urutan item pertama yang pada satu request
          required: false
          schema:
            type: integer
            format: int32
      responses:
        "200":
          $ref: "#/components/responses/LaporList"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      x-frapp-permission: create-report
      summary: Melaporkan diskusi atau komentar
      operationId: createReport
      tags:
        - Lapor
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id_diskusi:
                  type: integer
                  format: int32
                  example: 123
                id_komentar:
                  type: integer
                  format: int32
                  example: 60
                id_kategori:
                  type: integer
                  format: int32
                  example: 1
                isi:
                  type: string
                  example: Komentar ini menyinggung masalah ras dan suku bangsa
              required:
                - id_diskusi
                - id_kategori
                - isi
      responses:
        200:
          description: Laporan sukses dibuat
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    LaporKategori:
      properties:
        id:
          type: integer
          format: int32
        nama:
          type: string
    BaseListData:
      type: object
      properties:
        total_record:
          type: integer
          format: int32
        per_page:
          type: integer
          format: int32
        total_page:
          type: integer
          format: int32
        result:
          type: object
    Lapor:
      properties:
        id:
          type: integer
          format: int32
        id_diskusi:
          type: integer
          format: int32
        id_komentar:
          type: integer
          format: int32
        id_user:
          type: integer
          format: int32
        isi:
          type: string
        kategori:
          $ref: "#/components/schemas/LaporKategori"
        created_at:
          type: string
          format: date-time
        status:
          type: integer
          format: int32
          enum:
            - 0
            - 1
            - 2
            - 3
          x-enum-varnames:
            - Dilaporkan
            - Ditolak
            - Diterima
            - Ditindaklanjuti
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
  responses:
    LaporList:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/BaseListData"
              - type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: "#/components/schemas/Lapor"
