{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Client",
    "type": "object",
    "properties": {
        "id": { "type": "string", "format": "uuid" },
        "companyId": { "type": "string", "format": "uuid" },
        "clientCode": { "type": "string" },
        "fullName": {
            "type": ["object", "string", "null"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "email": {
            "type": ["object", "string", "null"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "emailHash": { "type": ["string", "null"] },
        "phone": {
            "type": ["object", "string", "null"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "location": {
            "type": "object",
            "properties": {
                "address": {
                    "type": "object",
                    "properties": {
                        "addressLine1": { "type": "string" },
                        "addressLine2": { "type": "string" }
                    },
                    "required": ["addressLine1"]
                },
                "city": { "type": "string" },
                "state": { "type": "string" },
                "zipCode": { "type": "string" },
                "country": { "type": "string" }
            },
            "required": ["address"]
        },
        "taxId": {
            "type": ["object", "string", "null"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "taxIdHash": { "type": ["string", "null"] },
        "extraData": { "type": "object" },
        "active": { "type": "boolean" },
        "notes": { "type": "string" },
        "createdAt": { "type": "string", "format": "date-time" },
        "createdBy": { "type": "string", "format": "uuid" },
        "updatedAt": { "type": "string", "format": "date-time" },
        "updatedBy": { "type": "string", "format": "uuid" },
        "deletedAt": { "type": "string", "format": "date-time" },
        "deletedBy": { "type": "string", "format": "uuid" }
    },
    "required": [
        "id",
        "companyId",
        "clientCode",
        "active",
        "createdAt",
        "createdBy"
    ]
}
