{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "customer.schema.json",
  "title": "customer",
  "type": "object",
  "description": "Enthält Vorversicherungsdaten",
  "properties": {
    "lead_id": {
      "type": "string",
      "pattern": "^HHV-([0-9]+)$",
      "minLength": 1,
      "description": "CHECK24-interne ID"
    },
    "gender": {
      "type": "string",
      "$ref": "enums/gender.schema.json#/$defs/gender",
      "description": "Geschlecht"
    },
    "firstname": {
      "type": "string",
      "minLength": 1,
      "description": "Vorname"
    },
    "lastname": {
      "type": "string",
      "minLength": 1,
      "description": "Nachname"
    },
    "email": {
      "type": "string",
      "format": "email",
      "minLength": 1,
      "description": "E-Mail-Adresse"
    },
    "phone": {
      "type": "string",
      "description": "Telefonnummer"
    },
    "birthdate": {
      "type": "string",
      "format": "date",
      "minLength": 1,
      "description": "Geburtsdatum - 'YYYY-MM-DD'"
    },
    "comment": {
      "type": "string",
      "description": "Kommentar des Kunden"
    },
    "address": {
      "$ref": "adress.schema.json",
      "description": "Adressdaten"
    },
    "product_dependent": {
      "type": "object",
      "properties": {
        "publicservice": {
          "type": "boolean",
          "description": "Ob Versicherungsnehmer im öffentlichen Dienst arbeitet"
        },
        "animals": {
          "type": "array",
          "minItems": 1,
          "maxItems": 9,
          "items": {
            "$ref": "animal.schema.json"
          },
          "description": "Hundedaten"
        }
      },
      "required": ["publicservice", "animals"],
      "if": {"properties": {"publicservice": {"const": true} } },
      "then": {
        "properties": {
          "occupation": {
            "type": "string",
            "description": "Beruf (wird nur befüllt, wenn VN im ÖD ist)"
          },
          "employer": {
            "type": "string",
            "description": "Arbeitgeber (nur befüllt, wenn VN im ÖD ist)"
          }
        }
      }
    }
  },
  "required": [
    "lead_id",
    "gender",
    "firstname",
    "lastname",
    "email",
    "birthdate",
    "address",
    "product_dependent"
  ]
}
