openapi: 3.0.3
info:
  title: Repzo API - Asset Type
  version: 1.0.0
  description: OpenAPI specification for Repzo Asset Type endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /asset-type:
    get:
      summary: Find asset types
      operationId: findAssetTypes
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering asset types
      responses:
        "200":
          description: A list of asset types
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeFindResult"
    post:
      summary: Create an asset type
      operationId: createAssetType
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetTypeCreateBody"
      responses:
        "201":
          description: Asset type created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeCreateResult"
  /asset-type/{id}:
    get:
      summary: Get an asset type by ID
      operationId: getAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset type details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeGetResult"
    put:
      summary: Update an asset type
      operationId: updateAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetTypeUpdateBody"
      responses:
        "200":
          description: Asset type updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeUpdateResult"
    delete:
      summary: Remove an asset type
      operationId: removeAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset type removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeRemoveResult"
components:
  schemas:
    AssetTypeFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/AssetType"
        meta:
          type: object
    AssetTypeCreateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
    AssetTypeCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeUpdateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
    AssetTypeUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    AssetType:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
