{
  "$defs": {
    "DisqualificationReason": {
      "description": "Disqualification reason.",
      "oneOf": [
        {
          "enum": [
            "no_budget",
            "no_need",
            "no_timeline",
            "other"
          ],
          "type": "string"
        },
        {
          "const": "not_icp",
          "description": "Not the buyer / wrong persona.",
          "type": "string"
        },
        {
          "const": "lost_to_competitor",
          "description": "Competitor already chosen.",
          "type": "string"
        },
        {
          "const": "junk_data",
          "description": "Bad data / junk lead.",
          "type": "string"
        },
        {
          "const": "opted_out",
          "description": "Opted out.",
          "type": "string"
        }
      ]
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "LeadSource": {
      "description": "Lead source.",
      "oneOf": [
        {
          "enum": [
            "inbound",
            "outbound_cold",
            "event",
            "webinar",
            "referral",
            "partner",
            "other"
          ],
          "type": "string"
        },
        {
          "const": "imported_list",
          "description": "Imported list (purchased / co-marketing).",
          "type": "string"
        },
        {
          "const": "existing_customer",
          "description": "Existing customer expansion.",
          "type": "string"
        },
        {
          "const": "self_service_sign_up",
          "description": "Public sign-up (Cockpit free tier).",
          "type": "string"
        }
      ]
    },
    "LeadStage": {
      "description": "Lifecycle stage (Forrester demand-waterfall).",
      "oneOf": [
        {
          "const": "inquiry",
          "description": "Raw inquiry, not contacted.",
          "type": "string"
        },
        {
          "const": "contacted",
          "description": "First contact attempt made.",
          "type": "string"
        },
        {
          "const": "engaged",
          "description": "Two-way engagement (reply received).",
          "type": "string"
        },
        {
          "const": "marketing_qualified",
          "description": "Marketing-Qualified Lead.",
          "type": "string"
        },
        {
          "const": "sales_accepted",
          "description": "Sales-Accepted Lead.",
          "type": "string"
        },
        {
          "const": "sales_qualified",
          "description": "Sales-Qualified Lead.",
          "type": "string"
        },
        {
          "const": "disqualified",
          "description": "Disqualified (firmly).",
          "type": "string"
        },
        {
          "const": "converted",
          "description": "Converted into an opportunity.",
          "type": "string"
        }
      ]
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    },
    "PiiClass": {
      "description": "Personal-data classification on every record carrying personal data, per\nBDR 0070 / BDR 0069 / BDR 0078. Used by `corpospec-report` to gate\nrendering and by the privacy pillar's RoPA records to determine\nsafeguards.",
      "oneOf": [
        {
          "const": "none",
          "description": "No personal data.",
          "type": "string"
        },
        {
          "const": "public_personal",
          "description": "Public personal data (already disclosed by the subject, e.g. CEO name).",
          "type": "string"
        },
        {
          "const": "internal",
          "description": "Internal-only personal data (employee directory).",
          "type": "string"
        },
        {
          "const": "personal",
          "description": "Personal data per GDPR Art. 4(1).",
          "type": "string"
        },
        {
          "const": "special_category",
          "description": "Special-category data per GDPR Art. 9 (health, biometric, genetic,\nreligion, ethnicity, sex life, political opinion, trade union).",
          "type": "string"
        },
        {
          "const": "criminal_data",
          "description": "Criminal data per GDPR Art. 10.",
          "type": "string"
        },
        {
          "const": "sensitive",
          "description": "CCPA / CPRA \"sensitive personal information\".",
          "type": "string"
        }
      ]
    },
    "QualificationFramework": {
      "description": "Qualification framework.",
      "oneOf": [
        {
          "enum": [
            "custom"
          ],
          "type": "string"
        },
        {
          "const": "bant",
          "description": "Budget / Authority / Need / Timeline.",
          "type": "string"
        },
        {
          "const": "champ",
          "description": "Champion / Authority / Money / Prioritisation.",
          "type": "string"
        },
        {
          "const": "gpcttbana_pi",
          "description": "Goals / Plans / Challenges / Timeline / Budget / Authority /\nNegative consequences / Positive implications.",
          "type": "string"
        },
        {
          "const": "meddpicc",
          "description": "Metrics / Economic-buyer / Decision-criteria / Decision-\nprocess / Identify-pain / Champion / Competition.",
          "type": "string"
        },
        {
          "const": "spin",
          "description": "SPIN selling (Situation / Problem / Implication / Need-payoff).",
          "type": "string"
        }
      ]
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/lead.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Lead record.",
  "properties": {
    "company_name": {
      "description": "Company name (free-form until linked to a Customer).",
      "type": [
        "string",
        "null"
      ]
    },
    "consent_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef to consent record (if Art. 6(1)(a) is the basis)."
    },
    "contact_pseudonym": {
      "description": "Pseudonymised contact handle (hash of email / phone).",
      "type": "string"
    },
    "converted_opportunity": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set when stage == Converted."
    },
    "created_at": {
      "$ref": "#/$defs/IsoDate"
    },
    "disqualification_reason": {
      "anyOf": [
        {
          "$ref": "#/$defs/DisqualificationReason"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set when stage == Disqualified."
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "job_title": {
      "description": "Job title (when known).",
      "type": [
        "string",
        "null"
      ]
    },
    "last_contacted_at": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ]
    },
    "lawful_basis": {
      "description": "Lawful basis for processing (Art. 6 GDPR — required for any\nEU subject).",
      "type": "string"
    },
    "lia_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef to LIA artefact (if Art. 6(1)(f) is the basis)."
    },
    "owner_sdr": {
      "$ref": "#/$defs/PathRef"
    },
    "pii_class": {
      "$ref": "#/$defs/PiiClass"
    },
    "qualification_framework": {
      "$ref": "#/$defs/QualificationFramework",
      "description": "Qualification framework + score (0-100)."
    },
    "qualification_score": {
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "source": {
      "$ref": "#/$defs/LeadSource"
    },
    "source_campaign": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Campaign that generated the lead (PathRef into campaign.rs)."
    },
    "stage": {
      "$ref": "#/$defs/LeadStage"
    }
  },
  "required": [
    "id",
    "entity",
    "contact_pseudonym",
    "source",
    "stage",
    "owner_sdr",
    "created_at",
    "qualification_framework",
    "lawful_basis",
    "pii_class"
  ],
  "title": "Lead",
  "type": "object",
  "x-corpospec-pillar": "market"
}