{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tagli-co-il/json-schema/tagli-co-il-quote-request-schema.json",
  "title": "QuoteRequest",
  "description": "Requires either `items` (non-empty array, prioritized if present; default server max 25 lines) or both `product_id` and `quantity` (positive integers).",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tagli-co-il-openapi.json#/components/schemas/QuoteRequest",
  "type": "object",
  "properties": {
    "product_id": {
      "type": "integer",
      "minimum": 1
    },
    "quantity": {
      "type": "integer",
      "minimum": 1
    },
    "options": {
      "$ref": "#/$defs/ProductOptions"
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "maxItems": 25,
      "items": {
        "$ref": "#/$defs/QuoteItem"
      }
    },
    "customer_contact": {
      "$ref": "#/$defs/CustomerContact"
    },
    "idempotency_key": {
      "type": "string"
    }
  },
  "oneOf": [
    {
      "required": [
        "items"
      ]
    },
    {
      "required": [
        "product_id",
        "quantity"
      ],
      "not": {
        "required": [
          "items"
        ]
      }
    }
  ],
  "$defs": {
    "CustomerContact": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "phone": {
          "type": "string"
        },
        "company": {
          "type": "string"
        },
        "email_dispatch_consent": {
          "type": "boolean",
          "description": "Must be true on `/agent/quote` to dispatch an email copy to `email`."
        }
      },
      "additionalProperties": true
    },
    "ProductOptions": {
      "type": "object",
      "description": "Product configuration options. For standard products (BuyAction V2): use `variation_id` and/or attribute `color` (e.g. cap color). For apparel products (BuyAction V3): use `color`, `branding` (`front`, `back`, `front_back`), `sleeve` (`0` or `1`), and `sizes` (non-negative integers whose sum must equal the line `quantity`).",
      "properties": {
        "variation_id": {
          "type": "integer",
          "minimum": 1
        },
        "color": {
          "type": "string"
        },
        "branding": {
          "type": "string"
        },
        "sleeve": {
          "type": "integer",
          "enum": [
            0,
            1
          ]
        },
        "sizes": {
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "additionalProperties": false
    },
    "QuoteItem": {
      "type": "object",
      "required": [
        "product_id",
        "quantity"
      ],
      "properties": {
        "product_id": {
          "type": "integer",
          "minimum": 1
        },
        "quantity": {
          "type": "integer",
          "minimum": 1
        },
        "options": {
          "$ref": "#/$defs/ProductOptions"
        }
      }
    }
  }
}