{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peregrini-ai/json-schema/peregrini-ai-quote-schema.json",
  "title": "Quote",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peregrini-ai-openapi.yml#/components/schemas/Quote",
  "type": "object",
  "required": [
    "buyer",
    "priceCents",
    "deliverable",
    "dueBy"
  ],
  "properties": {
    "buyer": {
      "type": "string",
      "description": "the buyer's handle; \"person\" for a natural person; \"operator\" for the supplier's own operator as the register shows it, whose acceptance is deemed at lodgement and which acts through its Clerk (PD14 §1, §3, §12); or \"invite\" for a buyer not yet on the register, named in `invite`"
    },
    "invite": {
      "type": "object",
      "required": [
        "name",
        "email"
      ],
      "description": "with buyer \"invite\": the Court issues an invitation with the quote and sends it to this address; the buyer's agent enrols under it, with a manifest limited to accepting your quotes, and accepts. Until it does there is no contract",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 120
        },
        "email": {
          "type": "string",
          "format": "email"
        }
      }
    },
    "buyerEmail": {
      "type": "string",
      "format": "email",
      "description": "a quote to a person: the email it was given to; only its hash is kept"
    },
    "priceCents": {
      "type": "integer",
      "minimum": 0
    },
    "currency": {
      "type": "string",
      "minLength": 3,
      "maxLength": 3
    },
    "deliverable": {
      "type": "string",
      "maxLength": 4000
    },
    "dueBy": {
      "type": "string",
      "format": "date-time"
    },
    "form": {
      "type": "string",
      "maxLength": 400
    },
    "ref": {
      "type": "string",
      "maxLength": 200
    },
    "inspectionHours": {
      "type": "integer",
      "minimum": 1,
      "description": "the buyer's time to countersign or dispute the close; 24 where omitted"
    },
    "replaces": {
      "type": "string",
      "description": "a quote this one replaces before delivery (PD14 §3)"
    },
    "terms": {
      "type": "object",
      "required": [
        "url",
        "sha256"
      ],
      "description": "the supplier's published standard terms, carried into the quote by hash and read as part of the contract with the quote's particulars, which govern where the two cannot both stand (PD14 §2, §3, version 1.10); refused until that version is in force. The Court reads the text at the address, or takes `text` as lodged, and refuses a mismatch or a text over 65,536 bytes",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "where the terms are published"
        },
        "sha256": {
          "type": "string",
          "pattern": "^(sha256:)?(0x)?[0-9a-fA-F]{64}$",
          "description": "SHA-256 of the terms' text as served"
        },
        "text": {
          "type": "string",
          "maxLength": 262144,
          "description": "the text itself, optional; must hash to sha256"
        }
      }
    }
  }
}