{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agent-resume.dev/schemas/jdcdm/v1.0.0/schema.json",
  "title": "Job Description Canonical Data Model (JD-CDM)",
  "description": "Standardized schema for representing job descriptions for AI-powered candidate matching",
  "type": "object",
  "required": ["schema_version", "job_id", "title", "company"],
  "additionalProperties": false,
  "properties": {
    "schema_version": { "type": "string", "const": "1.0.0" },
    "job_id": { "type": "string", "format": "uuid" },
    "external_id": { "type": "string" },
    "title": { "type": "string", "minLength": 1 },
    "department": { "type": "string" },
    "employment_type": {
      "type": "string",
      "enum": ["Full-time", "Part-time", "Contract", "Internship", "Temporary"]
    },
    "date_posted": { "type": "string", "format": "date-time" },
    "expires_at": { "type": ["string", "null"], "format": "date-time" },
    "description": { "type": "string" },
    "application_url": { "type": "string", "format": "uri" },
    "company": {
      "type": "object",
      "required": ["name"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "description": { "type": "string" },
        "industry": { "type": "string" },
        "location": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "city": { "type": "string" },
            "state": { "type": "string" },
            "country": { "type": "string" }
          }
        }
      }
    },
    "work_location": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "city": { "type": "string" },
        "state": { "type": "string" },
        "country": { "type": "string" }
      }
    },
    "remote_option": {
      "type": "string",
      "enum": ["Remote", "Hybrid", "Onsite", "Flexible", "Unknown"]
    },
    "salary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "currency": { "type": "string", "default": "USD" },
        "minimum": { "type": ["integer", "null"] },
        "maximum": { "type": ["integer", "null"] },
        "period": { "type": "string", "enum": ["Annual", "Monthly", "Hourly"] }
      }
    },
    "equity": {
      "type": ["object", "null"],
      "additionalProperties": false,
      "properties": {
        "type": { "type": "string", "enum": ["Options", "RSUs", "Shares", "Phantom"] },
        "amount": { "type": "string" },
        "vesting_schedule": { "type": "string" }
      }
    },
    "benefits": { "type": "array", "items": { "type": "string" } },
    "experience_level": {
      "type": "string",
      "enum": ["Entry-Level", "Junior", "Mid-Level", "Senior", "Lead", "Director", "VP", "C-Level"]
    },
    "years_of_experience": { "type": ["integer", "null"], "minimum": 0 },
    "sponsorship_available": { "type": ["boolean", "null"] },
    "responsibilities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["description"],
        "additionalProperties": false,
        "properties": {
          "description": { "type": "string" },
          "category": { "type": "string" }
        }
      }
    },
    "qualifications": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["requirement_type", "level"],
        "additionalProperties": false,
        "properties": {
          "requirement_type": {
            "type": "string",
            "enum": ["Skill", "Education", "Certification", "Experience", "Other"]
          },
          "name": { "type": "string" },
          "years_experience": { "type": ["integer", "null"], "minimum": 0 },
          "level": {
            "type": "string",
            "enum": ["Knock-Out", "Required", "Preferred", "Optional"]
          },
          "degree": { "type": "string" },
          "description": { "type": "string" }
        }
      }
    },
    "skills": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["skill", "level"],
        "additionalProperties": false,
        "properties": {
          "skill": { "type": "string" },
          "normalized_skill": { "type": "string" },
          "level": {
            "type": "string",
            "enum": ["Knock-Out", "Required", "Preferred", "Optional"]
          },
          "years_experience": { "type": ["integer", "null"], "minimum": 0 }
        }
      }
    },
    "education": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "degree": { "type": "string" },
          "field": { "type": "string" },
          "required": { "type": "boolean" },
          "level": {
            "type": "string",
            "enum": ["Knock-Out", "Required", "Preferred", "Optional"]
          }
        }
      }
    },
    "certifications": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "additionalProperties": false,
        "properties": {
          "name": { "type": "string" },
          "level": {
            "type": "string",
            "enum": ["Knock-Out", "Required", "Preferred", "Optional"]
          }
        }
      }
    },
    "tags": { "type": "array", "items": { "type": "string" } },
    "summary": { "type": "string" },
    "social_media_summaries": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "summary_linkedin": { "type": "string" },
        "summary_instagram": { "type": "string" },
        "summary_x": { "type": "string", "maxLength": 280 },
        "summary_email": { "type": "string" },
        "summary_sms": { "type": "string", "maxLength": 160 }
      }
    },
    "application_instructions": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "instructions": { "type": "string" },
        "errata": { "type": "string" }
      }
    },
    "embedding_vector": { "type": "array", "items": { "type": "number" } },
    "created_at": { "type": "string", "format": "date-time" },
    "updated_at": { "type": "string", "format": "date-time" }
  }
}
