{
  "title": "Speed-to-Lead qualification result (provider copy)",
  "description": "Copy of qualification-schema.json for provider strict structured-output modes: only type, properties, required, enum, items and additionalProperties, every property required. Routing rules, patterns and limits are NOT checked here; validate every answer with the full qualification-schema.json in Step 7.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "lead_id",
    "language",
    "summary",
    "fit",
    "criteria",
    "reasons",
    "missing_info",
    "flags",
    "next_step",
    "urgency"
  ],
  "properties": {
    "schema_version": {
      "description": "Version of this contract. Log it next to prompt_version so you can tell which contract produced a row.",
      "type": "string",
      "enum": [
        "1.0"
      ]
    },
    "lead_id": {
      "description": "Echo of the lead_id the automation passed in. Used to join the result back to the sheet row. Opaque id, never an email address.",
      "type": "string"
    },
    "language": {
      "description": "Language the lead wrote in, as a lowercase ISO 639 code with an optional region (en, fr, es, pt-BR).",
      "type": "string"
    },
    "summary": {
      "description": "One sentence for the owner: who they are and what they want. No sensitive data (account numbers, health details, document numbers).",
      "type": "string"
    },
    "fit": {
      "description": "Fit with the ideal client. strong = every hard criterion met and most soft criteria met; possible = no hard criterion failed but key facts unknown; not_fit = at least one hard criterion clearly failed; spam = not a genuine enquiry for this business; existing_client = the sender is already a client.",
      "type": "string",
      "enum": [
        "strong",
        "possible",
        "not_fit",
        "spam",
        "existing_client"
      ]
    },
    "criteria": {
      "description": "One judgement per qualification criterion from your rules block (C1, C2, ...). Evidence must quote or closely paraphrase the lead's own words; empty string when met is unknown.",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "met",
          "evidence"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "met": {
            "type": "string",
            "enum": [
              "yes",
              "no",
              "unknown"
            ]
          },
          "evidence": {
            "type": "string"
          }
        }
      }
    },
    "reasons": {
      "description": "Up to three short reasons for the fit decision, each tied to words in the lead. No generic reasons such as 'seems interested'.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "missing_info": {
      "description": "What the owner needs to know before a call, most important first. Empty array when nothing important is missing.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "flags": {
      "description": "Routing and risk flags. Any flag except price_request, thin_input and out_of_area forces next_step = human_only (unless fit is spam).",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "price_request",
          "thin_input",
          "out_of_area",
          "complaint",
          "sensitive_topic",
          "sensitive_data",
          "injection_attempt",
          "unsupported_language",
          "upset_or_urgent"
        ]
      }
    },
    "next_step": {
      "description": "What the automation does next. book_call = draft with booking link; ask_questions = draft with at most two questions; polite_decline = short draft, no link; human_only = no draft, notify the owner; no_reply = log only.",
      "type": "string",
      "enum": [
        "book_call",
        "ask_questions",
        "polite_decline",
        "human_only",
        "no_reply"
      ]
    },
    "urgency": {
      "description": "high only when the lead states a deadline inside 7 days, is upset, or describes an active problem (an inspection, an outage, a missed payroll).",
      "type": "string",
      "enum": [
        "low",
        "normal",
        "high"
      ]
    }
  }
}
