{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://physicaleurope.com/api/build-request.schema.json",
  "title": "physicaleurope build request",
  "description": "Request a one-off hardware build: physicaleurope sources the parts from European suppliers, books assembly and transport, and replies with one price and one delivery date. Send it as JSON with POST /api/submit. A person reviews each request and replies to the email in it.",
  "type": "object",
  "required": ["kind", "fields"],
  "properties": {
    "kind": { "const": "build_request" },
    "fields": {
      "type": "object",
      "required": ["email", "request"],
      "properties": {
        "email": { "type": "string", "format": "email", "description": "Where the reply with price and delivery date goes." },
        "name": { "type": "string", "description": "Name of the person asking." },
        "company": { "type": "string" },
        "phone": { "type": "string" },
        "source": { "type": "string", "description": "Where the request was sent from, e.g. the name of the agent or page." },
        "request": { "type": "string", "maxLength": 4000, "description": "What to build, in one or a few sentences." },
        "quantity": { "type": "integer", "minimum": 1, "default": 1, "description": "How many finished units." },
        "deliver_to": {
          "type": "object",
          "properties": {
            "country": { "type": "string", "description": "ISO 3166-1 alpha-2, e.g. DE." },
            "city": { "type": "string" },
            "postal_code": { "type": "string" }
          }
        },
        "needed_by": { "type": "string", "format": "date", "description": "Latest acceptable delivery date." },
        "budget_eur": { "type": "number", "minimum": 0 },
        "design_url": { "type": "string", "format": "uri", "description": "Link to the draft, drawings or CAD files." },
        "parts": {
          "type": "array",
          "description": "The bill of materials, one entry per line.",
          "items": {
            "type": "object",
            "required": ["item"],
            "properties": {
              "item": { "type": "string", "description": "What the part is, e.g. Housing panels." },
              "route": {
                "enum": ["make_to_drawing", "catalogue_part", "service"],
                "description": "Made to a drawing, bought from a catalogue, or a service on other lines: welding, coating, assembly, transport. The offering says which service."
              },
              "offering": { "type": "string", "description": "Offering slug from /api/offerings.json, e.g. laser_cutting." },
              "quantity": { "type": "number", "exclusiveMinimum": 0, "default": 1, "description": "Total for the whole request, in unit." },
              "unit": { "enum": ["pcs", "set", "m", "kg", "job"], "default": "pcs" },
              "material": { "type": "string" },
              "dimensions": { "type": "string" },
              "drawing_url": { "type": "string", "format": "uri" },
              "supplier_candidates": {
                "type": "array",
                "items": { "type": "string" },
                "description": "Supplier slugs from /api/suppliers.json, if already shortlisted."
              },
              "notes": { "type": "string" }
            }
          }
        }
      }
    }
  }
}
