{
  "$defs": {
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "LeaveEntry": {
      "description": "One entry in a person's leave ledger.",
      "properties": {
        "date": {
          "$ref": "#/$defs/IsoDate",
          "description": "Start date of the leave window."
        },
        "days": {
          "format": "double",
          "type": "number"
        },
        "document": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef into supporting document (medical certificate,\nparental-leave registration, etc.)."
        },
        "leave_type": {
          "$ref": "#/$defs/LeaveType"
        },
        "status": {
          "$ref": "#/$defs/LeaveStatus"
        }
      },
      "required": [
        "date",
        "leave_type",
        "days",
        "status"
      ],
      "type": "object"
    },
    "LeaveStatus": {
      "description": "Leave-request lifecycle status.",
      "enum": [
        "requested",
        "approved",
        "rejected",
        "taken",
        "cancelled"
      ],
      "type": "string"
    },
    "LeaveType": {
      "description": "Statutory leave type.",
      "oneOf": [
        {
          "enum": [
            "vacation",
            "sick",
            "parental",
            "sabbatical",
            "bereavement",
            "jury",
            "military",
            "study",
            "religious",
            "personal"
          ],
          "type": "string"
        },
        {
          "const": "care",
          "description": "PflegeZG care leave (DE).",
          "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"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/leave.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Per-person leave ledger.",
  "properties": {
    "balance_days": {
      "format": "double",
      "type": "number"
    },
    "entries": {
      "items": {
        "$ref": "#/$defs/LeaveEntry"
      },
      "type": "array"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "person": {
      "$ref": "#/$defs/PathRef"
    },
    "policy": {
      "$ref": "#/$defs/PathRef"
    }
  },
  "required": [
    "id",
    "person",
    "policy",
    "balance_days",
    "entries"
  ],
  "title": "LeaveLedger",
  "type": "object",
  "x-corpospec-pillar": "people"
}