{
  "$defs": {
    "Deduction": {
      "description": "One employee-side deduction line.",
      "properties": {
        "amount": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "kind": {
          "$ref": "#/$defs/DeductionKind"
        },
        "statute": {
          "description": "Statute citation (e.g. `\"§ 38 EStG\"`, `\"SGB IV § 28a\"`).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "amount"
      ],
      "type": "object"
    },
    "DeductionKind": {
      "description": "Employee-side deduction kind on a payslip.",
      "oneOf": [
        {
          "enum": [
            "other"
          ],
          "type": "string"
        },
        {
          "const": "lohnsteuer",
          "description": "DE wage tax.",
          "type": "string"
        },
        {
          "const": "solz",
          "description": "DE Solidaritätszuschlag.",
          "type": "string"
        },
        {
          "const": "kirchensteuer",
          "description": "DE Kirchensteuer.",
          "type": "string"
        },
        {
          "const": "kv_employee",
          "description": "DE Krankenversicherung — employee share.",
          "type": "string"
        },
        {
          "const": "rv_employee",
          "description": "DE Rentenversicherung — employee share.",
          "type": "string"
        },
        {
          "const": "av_employee",
          "description": "DE Arbeitslosenversicherung — employee share.",
          "type": "string"
        },
        {
          "const": "pv_employee",
          "description": "DE Pflegeversicherung — employee share.",
          "type": "string"
        },
        {
          "const": "uv_employee",
          "description": "DE Unfallversicherung — employee share (rare; usually employer-borne).",
          "type": "string"
        },
        {
          "const": "fica_ee",
          "description": "US Federal Insurance Contributions Act — employee share.",
          "type": "string"
        },
        {
          "const": "ni_ee",
          "description": "UK National Insurance — employee share.",
          "type": "string"
        }
      ]
    },
    "EmployerContribution": {
      "description": "One employer-side contribution line.",
      "properties": {
        "amount": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "kind": {
          "$ref": "#/$defs/EmployerContributionKind"
        },
        "statute": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "amount"
      ],
      "type": "object"
    },
    "EmployerContributionKind": {
      "description": "Employer-side contribution kind.",
      "oneOf": [
        {
          "enum": [
            "kv_employer",
            "rv_employer",
            "av_employer",
            "pv_employer",
            "uv_employer",
            "other"
          ],
          "type": "string"
        },
        {
          "const": "fica_er",
          "description": "US FICA — employer share.",
          "type": "string"
        },
        {
          "const": "futa",
          "description": "US Federal Unemployment Tax Act.",
          "type": "string"
        },
        {
          "const": "suta",
          "description": "US State Unemployment Tax.",
          "type": "string"
        },
        {
          "const": "ni_er",
          "description": "UK National Insurance — employer share.",
          "type": "string"
        }
      ]
    },
    "IsoCurrency": {
      "description": "ISO 4217 currency code.",
      "pattern": "^[A-Z]{3}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "MonetaryAmount": {
      "description": "A monetary value with currency.",
      "properties": {
        "amount": {
          "format": "double",
          "type": "number"
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "amount",
        "currency"
      ],
      "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"
        }
      ]
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/payslip.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Per-person payslip.",
  "properties": {
    "deductions": {
      "items": {
        "$ref": "#/$defs/Deduction"
      },
      "type": "array"
    },
    "document": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the encrypted PDF."
    },
    "employer_contributions": {
      "items": {
        "$ref": "#/$defs/EmployerContribution"
      },
      "type": "array"
    },
    "gross": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "net": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "person": {
      "$ref": "#/$defs/PathRef"
    },
    "pii_class": {
      "$ref": "#/$defs/PiiClass"
    },
    "retention_until": {
      "$ref": "#/$defs/IsoDate",
      "description": "Default pay_date + 10 years per §257 HGB."
    },
    "run": {
      "$ref": "#/$defs/PathRef",
      "description": "PathRef into the PayrollRun this payslip belongs to."
    },
    "total_employer_cost": {
      "$ref": "#/$defs/MonetaryAmount"
    }
  },
  "required": [
    "id",
    "person",
    "run",
    "gross",
    "deductions",
    "net",
    "employer_contributions",
    "total_employer_cost",
    "retention_until",
    "pii_class"
  ],
  "title": "Payslip",
  "type": "object",
  "x-corpospec-pillar": "people"
}