{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frihet-io/json-schema/frihet-io-quote-schema.json",
  "title": "Quote",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frihet-io-quotes-api-openapi.yml#/components/schemas/Quote",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    {
      "$ref": "#/$defs/QuoteCreate"
    },
    {
      "type": "object",
      "properties": {
        "documentNumber": {
          "type": "string",
          "description": "Auto-generated quote number"
        },
        "subtotal": {
          "type": "number",
          "description": "Subtotal before tax"
        },
        "tax": {
          "type": "number",
          "description": "Tax amount"
        },
        "total": {
          "type": "number",
          "description": "Total amount including tax"
        }
      }
    }
  ],
  "$defs": {
    "LineItem": {
      "type": "object",
      "required": [
        "description",
        "quantity",
        "unitPrice"
      ],
      "properties": {
        "description": {
          "type": "string",
          "description": "Item description"
        },
        "quantity": {
          "type": "number",
          "description": "Quantity"
        },
        "unitPrice": {
          "type": "number",
          "description": "Price per unit"
        }
      }
    },
    "QuoteCreate": {
      "type": "object",
      "required": [
        "clientName",
        "items"
      ],
      "properties": {
        "clientName": {
          "type": "string",
          "description": "Client name"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LineItem"
          },
          "minItems": 1
        },
        "validUntil": {
          "type": "string",
          "format": "date",
          "description": "Quote expiration date"
        },
        "status": {
          "$ref": "#/$defs/QuoteStatus"
        },
        "notes": {
          "type": "string",
          "description": "Additional notes"
        }
      }
    },
    "QuoteStatus": {
      "type": "string",
      "enum": [
        "draft",
        "sent",
        "accepted",
        "rejected",
        "expired"
      ]
    }
  }
}