openapi: 3.0.3
info:
  title: Repzo API - MSL Products
  version: 1.0.0
  description: OpenAPI specification for Repzo MSL Products endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /msl-products:
    get:
      summary: Find MSL products
      operationId: findMSLProducts
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering MSL products
      responses:
        "200":
          description: A list of MSL products
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductFindResult"
    post:
      summary: Create an MSL product
      operationId: createMSLProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLProductCreateBody"
      responses:
        "201":
          description: MSL product created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductCreateResult"
  /msl-products/{id}:
    get:
      summary: Get an MSL product by ID
      operationId: getMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL product details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductGetResult"
    put:
      summary: Update an MSL product
      operationId: updateMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLProductUpdateBody"
      responses:
        "200":
          description: MSL product updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductUpdateResult"
    delete:
      summary: Remove an MSL product
      operationId: removeMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL product removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductRemoveResult"
components:
  schemas:
    MSLProductFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MSLProduct"
        meta:
          type: object
    MSLProductCreateBody:
      type: object
      properties:
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
    MSLProductCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductUpdateBody:
      type: object
      properties:
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
    MSLProductUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    MSLProduct:
      type: object
      properties:
        _id:
          type: string
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
