{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Notification",
    "type": "object",
    "properties": {
        "id": { "type": "string", "format": "uuid" },
        "companyId": { "type": "string", "format": "uuid" },
        "clientId": { "type": "string", "format": "uuid" },
        "userId": { "type": "string", "format": "uuid" },
        "notificationTemplateId": { "type": "string", "format": "uuid" },
        "to": {
            "type": ["object", "string"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "from": {
            "type": ["object", "string", "null"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "type": { "type": "string", "enum": ["PAYMENT_UPLOADED", "PAYMENT_APPROVED", "PAYMENT_REJECTED", "DEBT_OVERDUE"] },
        "subject": {
            "type": ["object", "string"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "body": {
            "type": ["object", "string"],
            "properties": {
                "encryptedData": { "type": "string" },
                "keyName": { "type": "string" },
                "algorithm": { "type": "string" },
                "version": { "type": "integer" }
            },
            "required": ["encryptedData", "keyName"]
        },
        "channel": { "type": "string", "enum": ["EMAIL", "WHATSAPP", "SMS"] },
        "status": { "type": "string", "enum": ["PENDING", "SENT", "FAILED", "CANCELLED"] },
        "sentAt": { "type": "string", "format": "date-time" },
        "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",
        "to",
        "type",
        "subject",
        "body",
        "channel",
        "status",
        "createdAt",
        "createdBy"
    ]
}
