{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daon/json-schema/daon-push-notification-record-schema.json",
  "title": "PushNotificationRecord",
  "description": "A record of a push notification sent to a user's device application.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/daon-user-push-notification-management-api-openapi.yml#/components/schemas/PushNotificationRecord",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the push notification record.",
      "minLength": 1
    },
    "tenantId": {
      "type": "string",
      "description": "Identifier of the tenant associated with the push notification.",
      "minLength": 1
    },
    "storeId": {
      "type": "string",
      "description": "Identifier of the store associated with the push notification.",
      "minLength": 1
    },
    "userId": {
      "type": "string",
      "description": "Identifier of the user associated with the push notification.",
      "minLength": 1
    },
    "userExtId": {
      "type": "string",
      "description": "External identifier of the user associated with the push notification.",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "description": "Push notification send status",
      "enum": [
        "SUCCESS",
        "FAIL"
      ]
    },
    "rpId": {
      "type": "string",
      "description": "The relying party identifier associated with the push notification.",
      "minLength": 1
    },
    "type": {
      "type": "string",
      "description": "The push notification type.",
      "enum": [
        "TRUSTX",
        "GENERIC"
      ]
    },
    "subtype": {
      "type": "string",
      "description": "The push notification subtype.",
      "enum": [
        "APPKEY"
      ]
    },
    "createdDtm": {
      "type": "string",
      "format": "date-time",
      "description": "The time when the record was created."
    },
    "expiryDtm": {
      "type": "string",
      "format": "date-time",
      "description": "The time when the push notification expires."
    },
    "deviceId": {
      "type": "string",
      "description": "The device identifier to which the push notification was sent.",
      "minLength": 1
    },
    "cpiStatusId": {
      "type": "string",
      "description": "The optional process instance status identifier associated with a monitored TrustX push notification."
    },
    "errorCode": {
      "type": "integer",
      "format": "int32",
      "description": "Error code if the push notification failed to send."
    },
    "errorMessage": {
      "type": "string",
      "description": "Error message if the push notification failed to send."
    },
    "content": {
      "$ref": "#/$defs/PushNotificationContent",
      "description": "Push notification content."
    },
    "trustXPushRequestParams": {
      "$ref": "#/$defs/TrustXPushRequestParams",
      "description": "Additional parameters related to TrustX push requests."
    },
    "deliveryInfo": {
      "$ref": "#/$defs/PushNotificationDeliveryInfo",
      "description": "Information about the push service and attempts made."
    }
  },
  "required": [
    "createdDtm",
    "expiryDtm",
    "status",
    "subtype",
    "type"
  ],
  "$defs": {
    "ChildTrustXProcess": {
      "type": "object",
      "description": "Information about the TrustX process which is executed as the push notification action.",
      "properties": {
        "processDefnName": {
          "type": "string",
          "description": "Optional. The TrustX process definition name. Either name and version or a tag must be provided."
        },
        "processDefnVersion": {
          "type": "integer",
          "format": "int32",
          "description": "Optional. The TrustX process definition version. Either name and version or a tag must be provided."
        },
        "processDefnTag": {
          "type": "string",
          "description": "Optional. The TrustX process definition tag. Either name and version or a tag must be provided."
        },
        "monitorStatus": {
          "type": "boolean",
          "description": "If present and true then the status of the push notification TrustX process will be monitored.\nA polling URL will be generated which facilitates polling of the process status to wait for its completion."
        },
        "initParams": {
          "type": "object",
          "additionalProperties": {
            "type": "object"
          },
          "description": "Optional parameters to be supplied to the TrustX process when it is started."
        }
      }
    },
    "ParentTrustXProcess": {
      "type": "object",
      "description": "Information about the TrustX process which is executed as the push notification action.",
      "properties": {
        "processDefnId": {
          "type": "string",
          "description": "The TrustX process definition identifier.",
          "minLength": 1
        },
        "processDefnName": {
          "type": "string",
          "description": "The TrustX process definition name.",
          "minLength": 1
        },
        "processDefnVersion": {
          "type": "integer",
          "format": "int32",
          "description": "The TrustX process definition version."
        },
        "processInstanceId": {
          "type": "string",
          "description": "The TrustX process instance ID.",
          "minLength": 1
        }
      }
    },
    "PushNotificationAttempt": {
      "type": "object",
      "description": "Information about the destination of a push notification.",
      "properties": {
        "startDtm": {
          "type": "string",
          "format": "date-time"
        },
        "endDtm": {
          "type": "string",
          "format": "date-time"
        },
        "httpStatus": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "PushNotificationContent": {
      "type": "object",
      "description": "Contents of a push notification.",
      "properties": {
        "title": {
          "type": "string",
          "description": "A push notification title."
        },
        "message": {
          "type": "string",
          "description": "A push notification message."
        },
        "titleLocKey": {
          "type": "string",
          "description": "Optional key for a localisable push notification title."
        },
        "titleLocArgs": {
          "type": "array",
          "description": "Optional arguments for a localisable push notification title.",
          "items": {
            "type": "string"
          }
        },
        "messageLocKey": {
          "type": "string",
          "description": "Optional key for a localisable push notification message."
        },
        "messageLocArgs": {
          "type": "array",
          "description": "Optional arguments for a localisable push notification message.",
          "items": {
            "type": "string"
          }
        },
        "customProperties": {
          "type": "object",
          "additionalProperties": {
            "type": "object"
          },
          "description": "Optional custom properties to be included with the push notification."
        }
      }
    },
    "PushNotificationDeliveryInfo": {
      "type": "object",
      "description": "Content of a push notification.",
      "properties": {
        "service": {
          "type": "string",
          "description": "The service used to send the push notification.",
          "enum": [
            "FCM",
            "APNS"
          ]
        },
        "attempts": {
          "type": "array",
          "description": "Attempts made to send the push notification.",
          "items": {
            "$ref": "#/$defs/PushNotificationAttempt"
          }
        }
      }
    },
    "TrustXPushRequestParams": {
      "type": "object",
      "description": "Information required to create a TrustX push notification which is managed using a TrustX process.",
      "properties": {
        "parentTrustXProcess": {
          "$ref": "#/$defs/ParentTrustXProcess",
          "description": "The mandatory TrustX process from which the push notification is requested."
        },
        "childTrustXProcess": {
          "$ref": "#/$defs/ChildTrustXProcess",
          "description": "The mandatory TrustX process which is executed as the push notification action."
        }
      },
      "required": [
        "childTrustXProcess",
        "parentTrustXProcess"
      ]
    }
  }
}