{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://z15a.pl/z15a-export-v1.schema.json",
  "title": "z15a-export v1",
  "description": "Maszynowy, niezaszyfrowany eksport Konta i Danych Rodziny z15a.pl. Oba poziomy wymagają odblokowania Hasłem do Danych. Poziom basic zawiera jawne dane osobowe i ewidencję opieki, a pola profile/details, dokładna przyczyna i notatki wpisu oraz payload szkicu mają w nim wartość null. Poziom full zawiera także te odszyfrowane pola.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format", "version", "schema", "level", "exportedAt", "account",
    "legalDocuments", "family", "reminderSettings", "invitations", "subscription",
    "subscriptionOrders", "payments", "caregivers", "children", "familyMembers", "externalChildren",
    "careEntries", "formDrafts"
  ],
  "properties": {
    "format": { "const": "z15a-export" },
    "version": { "const": 1 },
    "schema": { "const": "https://z15a.pl/z15a-export-v1.schema.json" },
    "level": { "enum": ["basic", "full"] },
    "exportedAt": { "$ref": "#/$defs/dateTime" },
    "account": { "$ref": "#/$defs/account" },
    "legalDocuments": { "$ref": "#/$defs/legalDocuments" },
    "family": { "$ref": "#/$defs/family" },
    "reminderSettings": { "$ref": "#/$defs/reminderSettings" },
    "invitations": {
      "description": "Aktywne zaproszenia widoczne wyłącznie Właścicielowi Rodziny; dla pozostałych członków tablica jest pusta.",
      "type": "array",
      "items": { "$ref": "#/$defs/invitation" }
    },
    "subscription": { "$ref": "#/$defs/subscription" },
    "subscriptionOrders": { "type": "array", "items": { "$ref": "#/$defs/subscriptionOrder" } },
    "payments": { "type": "array", "items": { "$ref": "#/$defs/payment" } },
    "caregivers": { "type": "array", "items": { "$ref": "#/$defs/caregiver" } },
    "children": { "type": "array", "items": { "$ref": "#/$defs/child" } },
    "familyMembers": { "type": "array", "items": { "$ref": "#/$defs/familyMember" } },
    "externalChildren": { "type": "array", "items": { "$ref": "#/$defs/externalChild" } },
    "careEntries": { "type": "array", "items": { "$ref": "#/$defs/careEntry" } },
    "formDrafts": { "type": "array", "items": { "$ref": "#/$defs/formDraft" } }
  },
  "allOf": [
    {
      "if": { "properties": { "level": { "const": "basic" } }, "required": ["level"] },
      "then": {
        "properties": {
          "caregivers": { "items": { "properties": { "profile": { "type": "null" } } } },
          "children": { "items": { "properties": { "details": { "type": "null" } } } },
          "familyMembers": { "items": { "properties": { "details": { "type": "null" } } } },
          "careEntries": {
            "items": {
              "properties": {
                "cause": { "type": "null" }, "ezlaNumber": { "type": "null" }, "note": { "type": "null" }
              }
            }
          },
          "formDrafts": { "items": { "properties": { "payload": { "type": "null" } } } }
        }
      }
    }
  ],
  "$defs": {
    "id": { "type": "string", "minLength": 1, "maxLength": 64 },
    "date": { "type": "string", "format": "date" },
    "dateTime": { "type": "string", "format": "date-time" },
    "nullableDate": { "anyOf": [{ "$ref": "#/$defs/date" }, { "type": "null" }] },
    "nullableDateTime": { "anyOf": [{ "$ref": "#/$defs/dateTime" }, { "type": "null" }] },
    "nullableString": { "type": ["string", "null"] },
    "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "nullableSha256": { "anyOf": [{ "$ref": "#/$defs/sha256" }, { "type": "null" }] },

    "account": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "email", "name", "role", "createdAt", "updatedAt", "lastLoginAt", "healthDataConsentAt", "preferences", "mfa"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "email": { "type": "string", "format": "email" },
        "name": { "type": "string" }, "role": { "enum": ["user", "admin"] },
        "createdAt": { "$ref": "#/$defs/dateTime" }, "updatedAt": { "$ref": "#/$defs/dateTime" },
        "lastLoginAt": { "$ref": "#/$defs/nullableDateTime" },
        "healthDataConsentAt": { "$ref": "#/$defs/nullableDateTime" },
        "preferences": {
          "type": "object", "additionalProperties": false,
          "required": ["notifyEmail", "canvas", "autoLockMinutes"],
          "properties": {
            "notifyEmail": { "type": "boolean" }, "canvas": { "$ref": "#/$defs/nullableString" },
            "autoLockMinutes": { "type": ["integer", "null"], "minimum": 1 }
          }
        },
        "mfa": {
          "type": "object", "additionalProperties": false, "required": ["enabled", "enabledAt"],
          "properties": { "enabled": { "type": "boolean" }, "enabledAt": { "$ref": "#/$defs/nullableDateTime" } }
        }
      }
    },
    "legalSnapshot": {
      "type": ["object", "null"], "additionalProperties": false,
      "required": ["version", "contentSha256"],
      "properties": {
        "version": { "type": "string" }, "acceptedAt": { "$ref": "#/$defs/nullableDateTime" },
        "acknowledgedAt": { "$ref": "#/$defs/nullableDateTime" },
        "contentSha256": { "$ref": "#/$defs/nullableSha256" }
      }
    },
    "legalDocuments": {
      "type": "object", "additionalProperties": false,
      "required": ["acceptedTerms", "acknowledgedPrivacy", "notices"],
      "properties": {
        "acceptedTerms": { "$ref": "#/$defs/legalSnapshot" },
        "acknowledgedPrivacy": { "$ref": "#/$defs/legalSnapshot" },
        "notices": {
          "type": "array",
          "items": {
            "type": "object", "additionalProperties": false,
            "required": ["id", "kind", "version", "purpose", "status", "contentSha256", "createdAt", "deliveredAt"],
            "properties": {
              "id": { "$ref": "#/$defs/id" }, "kind": { "enum": ["terms", "privacy"] },
              "version": { "type": "string" }, "purpose": { "enum": ["change", "contract-confirmation"] },
              "status": { "enum": ["pending", "processing", "delivered", "cancelled", "dead"] },
              "contentSha256": { "$ref": "#/$defs/nullableSha256" },
              "createdAt": { "$ref": "#/$defs/dateTime" }, "deliveredAt": { "$ref": "#/$defs/nullableDateTime" }
            }
          }
        }
      }
    },
    "family": {
      "type": "object", "additionalProperties": false, "required": ["name"],
      "properties": { "name": { "type": "string" } }
    },
    "reminderSettings": {
      "type": "object", "additionalProperties": false, "required": ["mode", "epoch"],
      "properties": { "mode": { "enum": ["off", "approximate", "precise"] }, "epoch": { "type": "integer", "minimum": 1 } }
    },
    "invitation": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "email", "caregiverId", "expiresAt"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "email": { "type": "string", "format": "email" },
        "caregiverId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
        "expiresAt": { "$ref": "#/$defs/nullableDateTime" }
      }
    },
    "subscription": {
      "type": "object", "additionalProperties": false,
      "required": ["status", "children", "members", "currentPeriodEnd", "cancelAtPeriodEnd", "fundingSource", "sponsorName"],
      "properties": {
        "status": { "enum": ["none", "trialing", "active", "past_due", "canceled"] },
        "children": { "type": "integer", "minimum": 0 }, "members": { "type": "integer", "minimum": 0 },
        "currentPeriodEnd": { "$ref": "#/$defs/nullableDateTime" }, "cancelAtPeriodEnd": { "type": "boolean" },
        "fundingSource": { "enum": ["family", "sponsor"] }, "sponsorName": { "$ref": "#/$defs/nullableString" }
      }
    },
    "subscriptionOrder": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "actorUserId", "termsVersion", "termsSha256", "acceptedAt", "immediateAmountGr", "currency", "prorationDate", "children", "members", "completedAt", "createdAt"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "actorUserId": { "$ref": "#/$defs/id" },
        "termsVersion": { "type": "string" }, "termsSha256": { "$ref": "#/$defs/sha256" },
        "acceptedAt": { "$ref": "#/$defs/dateTime" },
        "immediateAmountGr": { "type": "integer", "minimum": 0 }, "currency": { "const": "pln" },
        "prorationDate": { "type": "integer", "minimum": 1 },
        "children": { "type": "integer", "minimum": 1 }, "members": { "type": "integer", "minimum": 0 },
        "completedAt": { "$ref": "#/$defs/nullableDateTime" }, "createdAt": { "$ref": "#/$defs/dateTime" }
      }
    },
    "payment": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "status", "amountGr", "currency", "periodStart", "periodEnd", "children", "members", "invoiceUrl", "paidAt", "termsVersion", "termsSha256", "acceptedAt", "termsAcceptance", "earlyPerformanceRequestedAt", "earlyPerformanceRequest", "refundStatus", "refundReason", "refundAmountGr", "refundSubmittedAt", "refundCompletedAt", "createdAt"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "status": { "enum": ["paid", "failed"] },
        "amountGr": { "type": "integer", "minimum": 0 }, "currency": { "type": "string" },
        "periodStart": { "$ref": "#/$defs/nullableDateTime" }, "periodEnd": { "$ref": "#/$defs/nullableDateTime" },
        "children": { "type": "integer", "minimum": 0 }, "members": { "type": "integer", "minimum": 0 },
        "invoiceUrl": { "$ref": "#/$defs/nullableString" }, "paidAt": { "$ref": "#/$defs/nullableDateTime" },
        "termsVersion": { "$ref": "#/$defs/nullableString" },
        "termsSha256": { "$ref": "#/$defs/nullableSha256" },
        "acceptedAt": { "$ref": "#/$defs/nullableDateTime" },
        "termsAcceptance": { "$ref": "#/$defs/nullableString" },
        "earlyPerformanceRequestedAt": { "$ref": "#/$defs/nullableDateTime" },
        "earlyPerformanceRequest": { "$ref": "#/$defs/nullableString" },
        "refundStatus": { "enum": ["pending", "processing", "submitted", "completed", "dead", null] },
        "refundReason": { "enum": ["deleted-family-checkout", "deleted-family-renewal", "duplicate-subscription-checkout", null] },
        "refundAmountGr": { "type": ["integer", "null"], "minimum": 0 },
        "refundSubmittedAt": { "$ref": "#/$defs/nullableDateTime" },
        "refundCompletedAt": { "$ref": "#/$defs/nullableDateTime" },
        "createdAt": { "$ref": "#/$defs/nullableDateTime" }
      }
    },

    "address": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "street": { "type": "string" }, "houseNo": { "type": "string" }, "flatNo": { "type": "string" },
        "postalCode": { "type": "string" }, "city": { "type": "string" }, "country": { "type": "string" }
      }
    },
    "platnik": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "nip": { "type": "string" }, "regon": { "type": "string" }, "pesel": { "type": "string" },
        "idDoc": { "type": "string" }, "name": { "type": "string" }
      }
    },
    "payer": {
      "type": "object", "additionalProperties": false, "required": ["id"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "nip": { "type": "string" }, "regon": { "type": "string" },
        "pesel": { "type": "string" }, "idDoc": { "type": "string" }, "name": { "type": "string" },
        "employedFrom": { "type": "string" }, "employedTo": { "$ref": "#/$defs/nullableString" }
      }
    },
    "caregiverProfile": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "type": "string" }, "idDocType": { "type": "string" },
        "address": { "$ref": "#/$defs/address" }, "phone": { "type": "string" }, "bankAccount": { "type": "string" },
        "platnik": { "$ref": "#/$defs/platnik" }, "payers": { "type": "array", "items": { "$ref": "#/$defs/payer" } },
        "worksShifts": { "type": "boolean" }, "changedPlatnikThisYear": { "type": "boolean" }
      }
    },
    "childDetails": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "fullName": { "type": "string" }, "idDoc": { "type": "string" },
        "disabilityCertNo": { "type": "string" }
      }
    },
    "familyMemberDetails": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "fullName": { "type": "string" }, "birthDate": { "type": "string" },
        "idDoc": { "type": "string" }
      }
    },
    "caregiver": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "displayName", "kind", "art188Unit", "hasAccount", "profile"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "displayName": { "type": "string" },
        "kind": { "enum": ["parent", "guardian", "other"] }, "art188Unit": { "enum": ["days", "hours"] },
        "hasAccount": { "type": "boolean" },
        "profile": { "anyOf": [{ "$ref": "#/$defs/caregiverProfile" }, { "type": "null" }] }
      }
    },
    "child": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "displayName", "birthDate", "isDisabled", "details"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "displayName": { "type": "string" }, "birthDate": { "$ref": "#/$defs/date" },
        "isDisabled": { "type": "boolean" },
        "details": { "anyOf": [{ "$ref": "#/$defs/childDetails" }, { "type": "null" }] }
      }
    },
    "familyMember": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "displayName", "relation", "sharedHousehold", "details"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "displayName": { "type": "string" }, "relation": { "type": "string" },
        "sharedHousehold": { "type": "boolean" },
        "details": { "anyOf": [{ "$ref": "#/$defs/familyMemberDetails" }, { "type": "null" }] }
      }
    },
    "externalChild": {
      "type": "object", "additionalProperties": false, "required": ["id", "caregiverId", "displayName"],
      "properties": { "id": { "$ref": "#/$defs/id" }, "caregiverId": { "$ref": "#/$defs/id" }, "displayName": { "type": "string" } }
    },

    "healthClaimPurpose": {
      "type": "object", "additionalProperties": false,
      "required": ["subjectRecordId", "subjectType", "statementVersion", "privacyVersion", "privacyContentSha256", "declaredByUserId", "declaredAt"],
      "properties": {
        "subjectRecordId": { "$ref": "#/$defs/id" }, "subjectType": { "enum": ["child", "familyMember", "externalChild"] },
        "statementVersion": { "type": "string" }, "privacyVersion": { "type": "string" },
        "privacyContentSha256": { "$ref": "#/$defs/sha256" }, "declaredByUserId": { "$ref": "#/$defs/id" },
        "declaredAt": { "$ref": "#/$defs/dateTime" }
      }
    },
    "careEntry": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "caregiverId", "subjectType", "subjectId", "category", "dateFrom", "dateTo", "days", "art188Hours", "excludedFromLimit", "excludedReason", "source", "atPreviousPlatnik", "cause", "ezlaNumber", "note", "careEntryPurposeKind", "healthClaimPurpose"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "caregiverId": { "$ref": "#/$defs/id" },
        "subjectType": { "enum": ["child", "familyMember", "externalChild"] },
        "subjectId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
        "category": { "enum": ["child_healthy_u8", "child_sick_u14", "family_member_sick", "disabled_child_8_18", "art188"] },
        "dateFrom": { "$ref": "#/$defs/date" }, "dateTo": { "$ref": "#/$defs/date" },
        "days": { "type": "integer", "minimum": 0 }, "art188Hours": { "type": ["integer", "null"], "minimum": 0 },
        "excludedFromLimit": { "type": "boolean" }, "excludedReason": { "enum": ["newborn_support", null] },
        "source": { "enum": ["app", "manual_import", "opening_balance"] },
        "atPreviousPlatnik": { "type": "integer", "minimum": 0 },
        "cause": { "enum": ["child_sick", "child_care_disruption", "carer_unavailable", "family_member_sick", "newborn_support", "art188", null] },
        "ezlaNumber": { "$ref": "#/$defs/nullableString" }, "note": { "$ref": "#/$defs/nullableString" },
        "careEntryPurposeKind": { "enum": ["z15-claim", "art188", "opening-balance", "legacy-unclassified", null] },
        "healthClaimPurpose": { "anyOf": [{ "$ref": "#/$defs/healthClaimPurpose" }, { "type": "null" }] }
      }
    },

    "formDraftAuditEntry": {
      "type": "object", "additionalProperties": false,
      "required": ["action", "actorUserId", "firstAt", "lastAt", "firstRevision", "lastRevision", "saveCount"],
      "properties": {
        "action": { "enum": ["created", "content_saved", "status_changed", "pdf_generation_authorized", "reminder_projection_changed", "deleted", "history_started"] },
        "actorUserId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
        "firstAt": { "$ref": "#/$defs/dateTime" }, "lastAt": { "$ref": "#/$defs/dateTime" },
        "firstRevision": { "type": "integer", "minimum": 0 }, "lastRevision": { "type": "integer", "minimum": 0 },
        "saveCount": { "type": "integer", "minimum": 1 }
      }
    },
    "formDraft": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "type", "status", "currentStep", "label", "generatedAt", "submittedAt", "careEndsAt", "deadlineAt", "updatedAt", "careEntryId", "creatorUserId", "auditTrail", "payload"],
      "properties": {
        "id": { "$ref": "#/$defs/id" }, "type": { "enum": ["z15a", "z15b"] },
        "status": { "enum": ["draft", "generated", "submitted"] }, "currentStep": { "type": "integer", "minimum": 0 },
        "label": { "$ref": "#/$defs/nullableString" }, "generatedAt": { "$ref": "#/$defs/nullableDateTime" },
        "submittedAt": { "$ref": "#/$defs/nullableDateTime" }, "careEndsAt": { "$ref": "#/$defs/nullableDate" },
        "deadlineAt": { "$ref": "#/$defs/nullableDate" }, "updatedAt": { "$ref": "#/$defs/nullableDateTime" },
        "careEntryId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
        "creatorUserId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
        "auditTrail": { "type": "array", "items": { "$ref": "#/$defs/formDraftAuditEntry" } },
        "payload": { "anyOf": [{ "$ref": "#/$defs/z15aDraft" }, { "$ref": "#/$defs/z15bDraft" }, { "type": "null" }] }
      },
      "allOf": [
        {
          "if": { "properties": { "type": { "const": "z15a" } }, "required": ["type"] },
          "then": { "properties": { "payload": { "anyOf": [{ "$ref": "#/$defs/z15aDraft" }, { "type": "null" }] } } }
        },
        {
          "if": { "properties": { "type": { "const": "z15b" } }, "required": ["type"] },
          "then": { "properties": { "payload": { "anyOf": [{ "$ref": "#/$defs/z15bDraft" }, { "type": "null" }] } } }
        }
      ]
    },

    "draftDate": { "type": "string", "pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}\\.\\d{2}\\.\\d{4})$" },
    "dayCounts": {
      "type": "object", "additionalProperties": false,
      "properties": { "catA": { "type": "number" }, "catB": { "type": "number" }, "catC": { "type": "number" } }
    },
    "applicant": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "documentTypeSeriesNumber": { "type": "string" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "street": { "type": "string" }, "houseNumber": { "type": "string" },
        "apartmentNumber": { "type": "string" }, "postalCode": { "type": "string" }, "city": { "type": "string" },
        "country": { "type": "string" }, "phone": { "type": "string" }
      }
    },
    "draftPlatnik": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "nip": { "type": "string" }, "regon": { "type": "string" }, "pesel": { "type": "string" },
        "documentTypeSeriesNumber": { "type": "string" }, "name": { "type": "string" }
      }
    },
    "carePeriod": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "dateFrom": { "$ref": "#/$defs/draftDate" }, "dateTo": { "$ref": "#/$defs/draftDate" },
        "ezlaNumber": { "type": "string" }, "description": { "type": "string" }
      }
    },
    "z15aChild": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "documentTypeSeriesNumber": { "type": "string" },
        "firstName": { "type": "string" }, "lastName": { "type": "string" },
        "birthDate": { "$ref": "#/$defs/draftDate" }, "disabilityCertificate": { "type": ["boolean", "null"] }
      }
    },
    "z15aDeclarations": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "householdMemberCanCare": { "type": ["boolean", "null"] }, "householdMemberCanCareDays": { "type": "string" },
        "shiftWork": { "type": ["boolean", "null"] }, "shiftWorkHours": { "type": "string" },
        "sharedHouseholdWithSickChildOver14": { "type": ["boolean", "null"] },
        "platnikChanged": { "enum": ["tak", "nie", "nie_zmienialem", null] },
        "daysAtPreviousPlatnik": { "$ref": "#/$defs/dayCounts" }
      }
    },
    "z15aRelative": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "unknown": { "const": false }, "pesel": { "type": "string" },
        "documentTypeSeriesNumber": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "firstName": { "type": "string" }, "lastName": { "type": "string" },
        "works": { "type": ["boolean", "null"] }, "shiftWork": { "type": ["boolean", "null"] },
        "shiftWorkHours": { "type": "string" }, "receivedBenefit": { "type": ["boolean", "null"] },
        "benefitDays": { "$ref": "#/$defs/dayCounts" }
      }
    },
    "unknownRelative": {
      "type": "object", "additionalProperties": false, "required": ["unknown"],
      "properties": { "unknown": { "const": true } }
    },
    "z15aOtherMember": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "documentTypeSeriesNumber": { "type": "string" },
        "birthDate": { "$ref": "#/$defs/draftDate" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "benefitDaysTotal": { "type": "number" },
        "benefitDays": { "$ref": "#/$defs/dayCounts" }, "careBy": { "type": "string" }, "careOver": { "type": "string" }
      }
    },
    "z15aDraft": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "applicant": { "$ref": "#/$defs/applicant" }, "platnik": { "$ref": "#/$defs/draftPlatnik" },
        "payoutMode": { "enum": ["employer", "bank", "postal"] }, "bankAccount": { "type": "string" },
        "carePeriod": { "$ref": "#/$defs/carePeriod" }, "child": { "$ref": "#/$defs/z15aChild" },
        "declarations": { "$ref": "#/$defs/z15aDeclarations" },
        "secondParent": { "anyOf": [{ "$ref": "#/$defs/unknownRelative" }, { "$ref": "#/$defs/z15aRelative" }] },
        "spouse": { "anyOf": [{ "$ref": "#/$defs/z15aRelative" }, { "type": "null" }] },
        "otherMembers": { "type": "array", "items": { "$ref": "#/$defs/z15aOtherMember" }, "maxItems": 2 },
        "remarks": { "type": "string" }, "date": { "$ref": "#/$defs/draftDate" }
      }
    },

    "z15bPatient": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "documentTypeSeriesNumber": { "type": "string" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "relationship": { "type": "string" }
      }
    },
    "z15bDeclarations": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "householdMemberCanCare": { "type": ["boolean", "null"] }, "householdMemberCanCareDays": { "type": "string" },
        "sharedHouseholdWithPatient": { "type": ["boolean", "null"] },
        "platnikChanged": { "enum": ["tak", "nie", "nie_zmienialem", null] },
        "daysAtPreviousPlatnik": { "$ref": "#/$defs/dayCounts" }
      }
    },
    "z15bSpouse": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "documentTypeSeriesNumber": { "type": "string" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "works": { "type": ["boolean", "null"] },
        "receivedBenefit": { "type": ["boolean", "null"] }, "benefitDays": { "$ref": "#/$defs/dayCounts" }
      }
    },
    "z15bOtherMemberFirst": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "documentTypeSeriesNumber": { "type": "string" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "benefitDaysTotal": { "type": "number" }
      }
    },
    "z15bOtherMemberSecond": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "pesel": { "type": "string" }, "birthDate": { "$ref": "#/$defs/draftDate" },
        "documentTypeSeriesNumber": { "type": "string" }, "firstName": { "type": "string" },
        "lastName": { "type": "string" }, "daysChildrenU14": { "type": "number" },
        "daysOther": { "type": "number" }, "careBy": { "type": "string" }, "careOver": { "type": "string" }
      }
    },
    "z15bDraft": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "applicant": { "$ref": "#/$defs/applicant" }, "platnik": { "$ref": "#/$defs/draftPlatnik" },
        "payoutMode": { "enum": ["employer", "bank", "postal"] }, "bankAccount": { "type": "string" },
        "carePeriod": { "$ref": "#/$defs/carePeriod" }, "patient": { "$ref": "#/$defs/z15bPatient" },
        "declarations": { "$ref": "#/$defs/z15bDeclarations" },
        "spouse": { "anyOf": [{ "$ref": "#/$defs/z15bSpouse" }, { "type": "null" }] },
        "noSpouse": { "type": "boolean" }, "otherMemberFirst": { "$ref": "#/$defs/z15bOtherMemberFirst" },
        "otherMemberSecond": { "$ref": "#/$defs/z15bOtherMemberSecond" },
        "otherChildrenU14": { "enum": ["tak", "nie", "nie_dotyczy", null] },
        "remarks": { "type": "string" }, "date": { "$ref": "#/$defs/draftDate" }
      }
    }
  }
}
