{
  "$defs": {
    "ConsentRecord": {
      "description": "GDPR Art. 88 + §26 BDSG consent record for employment data processing.",
      "properties": {
        "evidence_ref": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef into the consent-evidence document."
        },
        "granted_at": {
          "$ref": "#/$defs/IsoDate"
        },
        "lawful_basis": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        }
      },
      "required": [
        "purpose",
        "granted_at",
        "lawful_basis"
      ],
      "type": "object"
    },
    "EmploymentContractStatus": {
      "description": "Contract lifecycle status.",
      "enum": [
        "draft",
        "signed",
        "active",
        "terminated",
        "superseded"
      ],
      "type": "string"
    },
    "EmploymentTerm": {
      "description": "Contract term type.",
      "oneOf": [
        {
          "enum": [
            "indefinite"
          ],
          "type": "string"
        },
        {
          "const": "fixed_term",
          "description": "Befristeter Arbeitsvertrag — fixed-term per TzBfG (DE).",
          "type": "string"
        },
        {
          "const": "trial",
          "description": "Trial period — separate from contractual probation.",
          "type": "string"
        },
        {
          "const": "probationary",
          "description": "Probationary period (Probezeit).",
          "type": "string"
        }
      ]
    },
    "IsoCountry": {
      "description": "ISO 3166-1 alpha-2 country code.",
      "pattern": "^[A-Z]{2}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "NonCompete": {
      "description": "Non-compete clause + Karenzentschädigung (DE post-employment\ncompensation requirement).",
      "properties": {
        "duration_months": {
          "format": "int32",
          "type": "integer"
        },
        "geographic_scope": {
          "description": "Geographic scope of the restriction.",
          "type": [
            "string",
            "null"
          ]
        },
        "karenz_entschaedigung_pct": {
          "description": "Karenzentschädigung percentage (DE: §74 HGB minimum 50% of last\nfixed comp).",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "duration_months",
        "karenz_entschaedigung_pct"
      ],
      "type": "object"
    },
    "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"
        }
      ]
    },
    "PostalAddress": {
      "description": "Physical address aligned with schema.org PostalAddress.",
      "properties": {
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "$ref": "#/$defs/IsoCountry"
        },
        "postal_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        },
        "street": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "country"
      ],
      "type": "object"
    },
    "WorkLocation": {
      "description": "Where work is performed.",
      "properties": {
        "address": {
          "anyOf": [
            {
              "$ref": "#/$defs/PostalAddress"
            },
            {
              "type": "null"
            }
          ]
        },
        "kind": {
          "$ref": "#/$defs/WorkLocationKind"
        },
        "remote_country": {
          "anyOf": [
            {
              "$ref": "#/$defs/IsoCountry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Country of remote work (relevant for A1 portable-document + tax\nwithholding determination)."
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "WorkLocationKind": {
      "enum": [
        "onsite",
        "hybrid",
        "remote"
      ],
      "type": "string"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/employment-contract.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Employment contract instance record.",
  "properties": {
    "applicable_collective_agreement": {
      "description": "Tarifvertrag (DE collective agreement) reference.",
      "type": [
        "string",
        "null"
      ]
    },
    "consent_record": {
      "anyOf": [
        {
          "$ref": "#/$defs/ConsentRecord"
        },
        {
          "type": "null"
        }
      ]
    },
    "end_date": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "End date for fixed-term contracts."
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "kind": {
      "description": "Free-form discriminator string (uses BDR 0069 EmploymentType\nvariant names — `geschaeftsfuehrer`, `arbeitnehmer`, `freelance`,\netc. — to avoid coupling to the existing enum at v0.x).",
      "type": "string"
    },
    "non_compete": {
      "anyOf": [
        {
          "$ref": "#/$defs/NonCompete"
        },
        {
          "type": "null"
        }
      ]
    },
    "notice_period_employee": {
      "type": "string"
    },
    "notice_period_employer": {
      "description": "Employer notice period as ISO 8601 duration (`P3M` = 3 months).",
      "type": "string"
    },
    "person": {
      "$ref": "#/$defs/PathRef"
    },
    "pii_class": {
      "$ref": "#/$defs/PiiClass"
    },
    "probation_end": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Probation end date — DE max 6 months; EU directive caps at 6\nmonths."
    },
    "retention_until": {
      "$ref": "#/$defs/IsoDate",
      "description": "Default retention: end_date + 10 years per HGB §257."
    },
    "role": {
      "$ref": "#/$defs/PathRef"
    },
    "signed_date": {
      "$ref": "#/$defs/IsoDate"
    },
    "signed_documents": {
      "description": "PathRefs to signed PDFs / scanned signatures.",
      "items": {
        "$ref": "#/$defs/PathRef"
      },
      "type": "array"
    },
    "start_date": {
      "$ref": "#/$defs/IsoDate"
    },
    "status": {
      "$ref": "#/$defs/EmploymentContractStatus"
    },
    "superseded_by": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the successor contract on promotion / role change."
    },
    "template_ref": {
      "$ref": "#/$defs/PathRef",
      "description": "PathRef into `legal/templates/<slug>` — the template the contract\nwas drafted from."
    },
    "term": {
      "$ref": "#/$defs/EmploymentTerm"
    },
    "weekly_hours": {
      "format": "double",
      "type": "number"
    },
    "work_location": {
      "$ref": "#/$defs/WorkLocation"
    },
    "working_time_account": {
      "description": "DE Arbeitszeitkonto flag.",
      "type": [
        "boolean",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "person",
    "role",
    "entity",
    "template_ref",
    "kind",
    "term",
    "start_date",
    "weekly_hours",
    "work_location",
    "notice_period_employer",
    "notice_period_employee",
    "signed_date",
    "signed_documents",
    "retention_until",
    "pii_class",
    "status"
  ],
  "title": "EmploymentContract",
  "type": "object",
  "x-corpospec-pillar": "people"
}