{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sparkscience.xyz/labs/order-schema.json",
  "title": "Spark Lab Network order request",
  "description": "One experimental brief for Spark Lab Network. Produced by the web form, by an AI agent following /labs/agent/SKILL.md, or by hand. This is a request for scoping and quotes, not a binding order.",
  "type": "object",
  "required": ["schema", "ref", "created", "channel", "service", "project", "constraints", "contact", "consent"],
  "additionalProperties": false,
  "properties": {
    "schema": { "const": "spark-lab-order/v1" },
    "ref": { "type": "string", "pattern": "^SPK-[0-9]{6}-[A-Z0-9]{4}$", "description": "Client-generated reference, SPK-YYMMDD-XXXX." },
    "created": { "type": "string", "format": "date-time" },
    "channel": { "enum": ["web-form", "agent", "x-dm", "email"] },
    "service": {
      "enum": ["gene", "protein", "binding", "chem", "cell", "adme", "invivo", "robotic", "cascade", "sourcing", "other"],
      "description": "gene = gene synthesis and cloning; protein = expression and purification; binding = binding and biophysics; chem = small-molecule or peptide synthesis; cell = cell-based assays; adme = in-vitro ADME and safety panels; invivo = rodent PK and efficacy; robotic = robotic or cloud-lab run; cascade = multi-stage programme; sourcing = provider sourcing and benchmarking only."
    },
    "project": {
      "type": "object",
      "required": ["title", "objective"],
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 3, "maxLength": 120 },
        "objective": { "type": "string", "minLength": 20, "maxLength": 2000, "description": "What decision the result feeds and what a good result looks like." },
        "modality": { "enum": ["small-molecule", "peptide", "protein", "antibody", "nucleic-acid", "cell", "other", "not-sure"] },
        "samples": { "type": "integer", "minimum": 1, "maximum": 100000, "description": "Number of molecules, constructs or samples." },
        "materials": { "enum": ["ship", "make", "data-only", "not-sure"], "description": "ship = requester provides material; make = provider must synthesise or express it; data-only = reanalysis; not-sure." },
        "assay": { "type": "string", "maxLength": 2000, "description": "Assay, readout, controls, replicates, acceptance criteria. Non-confidential level of detail." },
        "deliverables": { "type": "array", "uniqueItems": true, "items": { "enum": ["raw-data", "report", "qc-certificate", "sop", "material-back"] } }
      }
    },
    "constraints": {
      "type": "object",
      "required": ["budget", "regions", "confidentiality"],
      "additionalProperties": false,
      "properties": {
        "budget": { "enum": ["<5k", "5-20k", "20-100k", ">100k", "not-sure"], "description": "USD, whole request." },
        "needed_by": { "type": "string", "format": "date" },
        "speed": { "enum": ["standard", "fast"] },
        "regions": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["US", "CN", "EU", "any"] } },
        "confidentiality": { "enum": ["open", "nda-first", "strict"], "description": "open = can be shared with shortlisted providers as written; nda-first = NDA before details; strict = no third-party disclosure without written approval." },
        "flags": { "type": "array", "uniqueItems": true, "items": { "enum": ["animal", "human-material", "bsl2", "controlled", "export-control"] } }
      }
    },
    "contact": {
      "type": "object",
      "required": ["name", "email", "country"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 2, "maxLength": 80 },
        "email": { "type": "string", "format": "email", "maxLength": 120 },
        "x": { "type": "string", "pattern": "^@?[A-Za-z0-9_]{1,15}$" },
        "org": { "type": "string", "maxLength": 120 },
        "org_type": { "enum": ["academic", "startup", "biotech", "pharma", "ai-lab", "independent", "other"] },
        "country": { "type": "string", "minLength": 2, "maxLength": 60 },
        "prefer": { "enum": ["email", "x", "call"] }
      }
    },
    "consent": { "const": true, "description": "Requester confirms the brief contains no confidential sequences, structures or credentials, and agrees to be contacted about it." },
    "notes": { "type": "string", "maxLength": 1000 }
  }
}
