openapi: 3.0.0
info:
  title: Product Builder
  version: 1.0.0
servers:
  - url: http://{{backend_url}}
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
tags:
  - name: Admin
  - name: Admin > Auth
  - name: Store
paths:
  /auth/user/emailpass:
    post:
      tags:
        - Admin > Auth
      summary: Login
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: admin@medusajs.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /admin/products/{id}/builder:
    get:
      tags:
        - Admin
      summary: Get Builder Configurations
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          schema:
            type: string
          required: true
          example: prod_01K2F07DVJ7PVW5QMB6Y6WZMEF
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
        - Admin
      summary: Upsert Builder Configuration
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                custom_fields:
                  - name: Engraving
                    type: text
                complementary_products:
                  - product_id: prod_01K2F07DVJB5XQCBTE77GSHA2Z
                addon_products:
                  - product_id: prod_01K2F07DVJ0DDQEQP77Y4GREBF
      parameters:
        - name: id
          in: path
          schema:
            type: string
          required: true
          example: prod_01K2F07DVJ7PVW5QMB6Y6WZMEF
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /admin/products/addons:
    get:
      tags:
        - Admin
      summary: Retrieve Addon Products
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /admin/products/complementary:
    get:
      tags:
        - Admin
      summary: Retrieve Products for Complementary Selection
      security:
        - bearerAuth: []
      parameters:
        - name: exclude_product_id
          in: query
          schema:
            type: string
          example: prod_01K2F07DVJ0DDQEQP77Y4GREBF
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/carts/{id}/product-builder:
    post:
      tags:
        - Store
      summary: Add Product with Builder Config to Cart
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                product_id: prod_123
                variant_id: variant_321
                custom_field_values:
                  Engraving: John
                complementary_product_variants:
                  - variant_123
                addon_variants:
                  - variant_456
      parameters:
        - name: id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/carts/{id}/product-builder/{item_id}:
    delete:
      tags:
        - Store
      summary: Remove Product with Builder Config from Cart
      parameters:
        - name: id
          in: path
          schema:
            type: string
          required: true
        - name: item_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
