openapi: 3.0.0
info:
  title: Product Modifiers Group API
  description: API for managing product modifier groups
  version: 1.0.0
servers:
  - url: https://api.repzo.me/v1
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Product Modifiers Group
    description: Product modifier group management operations
paths:
  /product-modifiers-group:
    get:
      tags:
        - Product Modifiers Group
      summary: Get all product modifier groups
      description: Retrieve a list of all product modifier groups with optional filtering and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ProductModifiersGroup"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Product Modifiers Group
      summary: Create a new product modifier group
      description: Create a new product modifier group entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateProductModifiersGroupRequest"
      responses:
        "201":
          description: Product modifier group created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /product-modifiers-group/{id}:
    get:
      tags:
        - Product Modifiers Group
      summary: Get product modifier group by ID
      description: Retrieve a specific product modifier group by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Product Modifiers Group
      summary: Update product modifier group
      description: Update an existing product modifier group
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateProductModifiersGroupRequest"
      responses:
        "200":
          description: Product modifier group updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Product Modifiers Group
      summary: Delete product modifier group
      description: Delete a product modifier group by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      responses:
        "200":
          description: Product modifier group deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /product-modifiers-group/remove:
    post:
      tags:
        - Product Modifiers Group
      summary: Bulk delete product modifier groups
      description: Delete multiple product modifier groups by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of product modifier group IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Product modifier groups deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: "Use format: Bearer {api_key}"
  schemas:
    ProductModifiersGroup:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: "507f1f77bcf86cd799439011"
        name:
          type: string
          description: Product modifier group name
          example: "Size Options"
        description:
          type: string
          description: Group description
          example: "Available size options for products"
        modifiers:
          type: array
          items:
            $ref: "#/components/schemas/ProductModifier"
          description: List of modifiers in this group
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
          example: true
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
          example: 1
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - name
    ProductModifier:
      type: object
      properties:
        _id:
          type: string
          description: Modifier ID
        name:
          type: string
          description: Modifier name
          example: "Large"
        price_adjustment:
          type: number
          description: Price adjustment for this modifier
          example: 2.50
        description:
          type: string
          description: Modifier description
    CreateProductModifiersGroupRequest:
      type: object
      properties:
        name:
          type: string
          description: Product modifier group name
          example: "Size Options"
        description:
          type: string
          description: Group description
          example: "Available size options for products"
        modifiers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              price_adjustment:
                type: number
              description:
                type: string
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
          default: false
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
          default: 1
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
          default: false
      required:
        - name
    UpdateProductModifiersGroupRequest:
      type: object
      properties:
        name:
          type: string
          description: Product modifier group name
          example: "Size Options"
        description:
          type: string
          description: Group description
        modifiers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              price_adjustment:
                type: number
              description:
                type: string
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
    PagingInfo:
      type: object
      properties:
        total:
          type: integer
          description: Total number of items
        page:
          type: integer
          description: Current page number
        per_page:
          type: integer
          description: Items per page
        pages:
          type: integer
          description: Total number of pages
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Invalid request parameters"
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Authentication required"
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Insufficient permissions"
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Resource not found"
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Validation failed"
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: "Internal server error"
