openapi: 3.0.3
info:
  title: Repzo API - Custom Status
  version: 1.0.0
  description: OpenAPI specification for Repzo Custom Status endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /custom-status:
    get:
      summary: Find custom statuses
      operationId: findCustomStatuses
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering custom statuses
      responses:
        "200":
          description: A list of custom statuses
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusFindResult"
    post:
      summary: Create a custom status
      operationId: createCustomStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomStatusCreateBody"
      responses:
        "201":
          description: Custom status created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusCreateResult"
  /custom-status/{id}:
    get:
      summary: Get a custom status by ID
      operationId: getCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom status details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusGetResult"
    put:
      summary: Update a custom status
      operationId: updateCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomStatusUpdateBody"
      responses:
        "200":
          description: Custom status updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusUpdateResult"
    delete:
      summary: Remove a custom status
      operationId: removeCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom status removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusRemoveResult"
components:
  schemas:
    CustomStatusFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomStatus"
        meta:
          type: object
    CustomStatusCreateBody:
      type: object
      properties:
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomStatusCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusUpdateBody:
      type: object
      properties:
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomStatusUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    CustomStatus:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
