openapi: 3.0.3
info:
  title: Repzo API - Asset
  version: 1.0.0
  description: OpenAPI specification for Repzo Asset endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /asset:
    get:
      summary: Find assets
      operationId: findAssets
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering assets
      responses:
        "200":
          description: A list of assets
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetFindResult"
    post:
      summary: Create an asset
      operationId: createAsset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetCreateBody"
      responses:
        "201":
          description: Asset created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetCreateResult"
  /asset/{id}:
    get:
      summary: Get an asset by ID
      operationId: getAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetGetResult"
    put:
      summary: Update an asset
      operationId: updateAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetUpdateBody"
      responses:
        "200":
          description: Asset updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetUpdateResult"
    delete:
      summary: Remove an asset
      operationId: removeAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetRemoveResult"
components:
  schemas:
    AssetFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Asset"
        meta:
          type: object
    AssetCreateBody:
      type: object
      properties:
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
    AssetCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetUpdateBody:
      type: object
      properties:
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
    AssetUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Asset:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
