{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "type": "object",
  "title": "Program Trigger Variables",
  "description": "Defines the variables used for evaluating externally defined inputs (e.g. JSONata)",
  "properties": {
    "type": {
      "type": "string",
      "title": "Trigger Type",
      "description": "The reason the program was triggered (e.g. referral created, user changed something, etc.)",
      "enum": [
        "AFTER_USER_CREATED_OR_UPDATED",
        "SCHEDULED",
        "REWARD_SCHEDULED",
        "REFERRAL",
        "AFTER_USER_EVENT_PROCESSED"
      ]
    }
  },
  "dependencies": {
    "type": {
      "oneOf": [
        {
          "type": {
            "enum": [
              "AFTER_USER_CREATED_OR_UPDATED"
            ]
          },
          "user": {
            "title": "Current User",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              },
              "rewards": {
                "type": "object",
                "title": "Rewards",
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of rewards this user has received"
                  },
                  "data": {
                    "type": "array",
                    "title": "The Data Schema",
                    "description": "A list of the rewards this user has received (up to 20)",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "totalCount",
                  "data"
                ],
                "additionalProperties": false
              },
              "referrals": {
                "type": "object",
                "title": "The Referrals Schema",
                "required": [
                  "totalCount"
                ],
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of referrals this user has made"
                  }
                }
              },
              "referredByReferral": {
                "type": "object",
                "title": "Referred By Referral",
                "description": "The referral where this user was referred. Null when not a referral or partner program.",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Referral Id",
                    "description": "The unique identifier for this referral"
                  },
                  "dateReferralStarted": {
                    "type": "integer",
                    "title": "Date Referral Started",
                    "description": "The date this referral was created (attributed)"
                  },
                  "referrerUser": {
                    "type": "object",
                    "title": "Referrer",
                    "description": "The referring user, the one that referred the current user",
                    "properties": {
                      "id": {
                        "type": "string",
                        "title": "User Id"
                      },
                      "accountId": {
                        "type": "string",
                        "title": "Account Id"
                      },
                      "firstName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Name"
                      },
                      "lastName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Name"
                      },
                      "imageUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Image Url"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Email Address"
                      },
                      "cookieId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Cookie Id"
                      },
                      "locale": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Locale"
                      },
                      "countryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Country Code"
                      },
                      "referable": {
                        "type": "boolean",
                        "title": "Is Referable"
                      },
                      "firstSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Seen IP Address"
                      },
                      "lastSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Seen IP Address"
                      },
                      "dateCreated": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Created"
                      },
                      "dateBlocked": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Blocked"
                      },
                      "customFields": {
                        "$ref": "#/definitions/customFieldsContext"
                      },
                      "segments": {
                        "type": "array",
                        "title": "Segments",
                        "description": "A list of segments this user has been assigned to",
                        "items": {
                          "type": "string",
                          "title": "Segment Key",
                          "description": "A segment key this user has been assigned to (e.g. VIP)"
                        }
                      },
                      "fraudFlags": {
                        "type": "array",
                        "title": "Fraud Flags",
                        "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                        "items": {
                          "type": "object",
                          "title": "Fraud Flag",
                          "properties": {
                            "type": {
                              "type": "string",
                              "title": "Flag Type",
                              "enum": [
                                "IP",
                                "EMAIL",
                                "NAME",
                                "RATE",
                                "DAILY_REFERRAL_REWARD_LIMIT",
                                "TEMP_EMAIL",
                                "BLOCKED_USER",
                                "BLOCKED_IP"
                              ]
                            },
                            "message": {
                              "type": "string",
                              "title": "Flag Description"
                            }
                          },
                          "required": [
                            "type",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "rewards": {
                    "type": "array",
                    "title": "Referral Rewards",
                    "description": "A list of rewards associated with this referral",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "previous": {
            "title": "Previous User",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "time": {
            "type": "integer",
            "title": "Trigger Time",
            "description": "The current time at the moment the program is evaluated"
          }
        },
        {
          "type": {
            "enum": [
              "REWARD_SCHEDULED"
            ]
          },
          "user": {
            "title": "User",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              },
              "rewards": {
                "type": "object",
                "title": "Rewards",
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of rewards this user has received"
                  },
                  "data": {
                    "type": "array",
                    "title": "The Data Schema",
                    "description": "A list of the rewards this user has received (up to 20)",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "totalCount",
                  "data"
                ],
                "additionalProperties": false
              },
              "referrals": {
                "type": "object",
                "title": "The Referrals Schema",
                "required": [
                  "totalCount"
                ],
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of referrals this user has made"
                  }
                }
              },
              "referredByReferral": {
                "type": "object",
                "title": "Referred By Referral",
                "description": "The referral where this user was referred. Null when not a referral or partner program.",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Referral Id",
                    "description": "The unique identifier for this referral"
                  },
                  "dateReferralStarted": {
                    "type": "integer",
                    "title": "Date Referral Started",
                    "description": "The date this referral was created (attributed)"
                  },
                  "referrerUser": {
                    "type": "object",
                    "title": "Referrer",
                    "description": "The referring user, the one that referred the current user",
                    "properties": {
                      "id": {
                        "type": "string",
                        "title": "User Id"
                      },
                      "accountId": {
                        "type": "string",
                        "title": "Account Id"
                      },
                      "firstName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Name"
                      },
                      "lastName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Name"
                      },
                      "imageUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Image Url"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Email Address"
                      },
                      "cookieId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Cookie Id"
                      },
                      "locale": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Locale"
                      },
                      "countryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Country Code"
                      },
                      "referable": {
                        "type": "boolean",
                        "title": "Is Referable"
                      },
                      "firstSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Seen IP Address"
                      },
                      "lastSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Seen IP Address"
                      },
                      "dateCreated": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Created"
                      },
                      "dateBlocked": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Blocked"
                      },
                      "customFields": {
                        "$ref": "#/definitions/customFieldsContext"
                      },
                      "segments": {
                        "type": "array",
                        "title": "Segments",
                        "description": "A list of segments this user has been assigned to",
                        "items": {
                          "type": "string",
                          "title": "Segment Key",
                          "description": "A segment key this user has been assigned to (e.g. VIP)"
                        }
                      },
                      "fraudFlags": {
                        "type": "array",
                        "title": "Fraud Flags",
                        "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                        "items": {
                          "type": "object",
                          "title": "Fraud Flag",
                          "properties": {
                            "type": {
                              "type": "string",
                              "title": "Flag Type",
                              "enum": [
                                "IP",
                                "EMAIL",
                                "NAME",
                                "RATE",
                                "DAILY_REFERRAL_REWARD_LIMIT",
                                "TEMP_EMAIL",
                                "BLOCKED_USER",
                                "BLOCKED_IP"
                              ]
                            },
                            "message": {
                              "type": "string",
                              "title": "Flag Description"
                            }
                          },
                          "required": [
                            "type",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "rewards": {
                    "type": "array",
                    "title": "Referral Rewards",
                    "description": "A list of rewards associated with this referral",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "time": {
            "type": "integer",
            "title": "Trigger Time",
            "description": "The current time at the moment the program is evaluated"
          }
        },
        {
          "type": {
            "enum": [
              "SCHEDULED"
            ]
          },
          "user": {
            "title": "Current User Data",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              },
              "rewards": {
                "type": "object",
                "title": "Rewards",
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of rewards this user has received"
                  },
                  "data": {
                    "type": "array",
                    "title": "The Data Schema",
                    "description": "A list of the rewards this user has received (up to 20)",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "totalCount",
                  "data"
                ],
                "additionalProperties": false
              },
              "referrals": {
                "type": "object",
                "title": "The Referrals Schema",
                "required": [
                  "totalCount"
                ],
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of referrals this user has made"
                  }
                }
              },
              "referredByReferral": {
                "type": "object",
                "title": "Referred By Referral",
                "description": "The referral where this user was referred. Null when not a referral or partner program.",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Referral Id",
                    "description": "The unique identifier for this referral"
                  },
                  "dateReferralStarted": {
                    "type": "integer",
                    "title": "Date Referral Started",
                    "description": "The date this referral was created (attributed)"
                  },
                  "referrerUser": {
                    "type": "object",
                    "title": "Referrer",
                    "description": "The referring user, the one that referred the current user",
                    "properties": {
                      "id": {
                        "type": "string",
                        "title": "User Id"
                      },
                      "accountId": {
                        "type": "string",
                        "title": "Account Id"
                      },
                      "firstName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Name"
                      },
                      "lastName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Name"
                      },
                      "imageUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Image Url"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Email Address"
                      },
                      "cookieId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Cookie Id"
                      },
                      "locale": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Locale"
                      },
                      "countryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Country Code"
                      },
                      "referable": {
                        "type": "boolean",
                        "title": "Is Referable"
                      },
                      "firstSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Seen IP Address"
                      },
                      "lastSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Seen IP Address"
                      },
                      "dateCreated": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Created"
                      },
                      "dateBlocked": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Blocked"
                      },
                      "customFields": {
                        "$ref": "#/definitions/customFieldsContext"
                      },
                      "segments": {
                        "type": "array",
                        "title": "Segments",
                        "description": "A list of segments this user has been assigned to",
                        "items": {
                          "type": "string",
                          "title": "Segment Key",
                          "description": "A segment key this user has been assigned to (e.g. VIP)"
                        }
                      },
                      "fraudFlags": {
                        "type": "array",
                        "title": "Fraud Flags",
                        "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                        "items": {
                          "type": "object",
                          "title": "Fraud Flag",
                          "properties": {
                            "type": {
                              "type": "string",
                              "title": "Flag Type",
                              "enum": [
                                "IP",
                                "EMAIL",
                                "NAME",
                                "RATE",
                                "DAILY_REFERRAL_REWARD_LIMIT",
                                "TEMP_EMAIL",
                                "BLOCKED_USER",
                                "BLOCKED_IP"
                              ]
                            },
                            "message": {
                              "type": "string",
                              "title": "Flag Description"
                            }
                          },
                          "required": [
                            "type",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "rewards": {
                    "type": "array",
                    "title": "Referral Rewards",
                    "description": "A list of rewards associated with this referral",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "time": {
            "type": "integer",
            "title": "Trigger Time",
            "description": "The current time at the moment the program is evaluated"
          }
        },
        {
          "type": {
            "enum": [
              "REFERRAL"
            ]
          },
          "user": {
            "title": "Current User Data",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              },
              "rewards": {
                "type": "object",
                "title": "Rewards",
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of rewards this user has received"
                  },
                  "data": {
                    "type": "array",
                    "title": "The Data Schema",
                    "description": "A list of the rewards this user has received (up to 20)",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "totalCount",
                  "data"
                ],
                "additionalProperties": false
              },
              "referrals": {
                "type": "object",
                "title": "The Referrals Schema",
                "required": [
                  "totalCount"
                ],
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of referrals this user has made"
                  }
                }
              },
              "referredByReferral": {
                "type": "object",
                "title": "Referred By Referral",
                "description": "The referral where this user was referred. Null when not a referral or partner program.",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Referral Id",
                    "description": "The unique identifier for this referral"
                  },
                  "dateReferralStarted": {
                    "type": "integer",
                    "title": "Date Referral Started",
                    "description": "The date this referral was created (attributed)"
                  },
                  "referrerUser": {
                    "type": "object",
                    "title": "Referrer",
                    "description": "The referring user, the one that referred the current user",
                    "properties": {
                      "id": {
                        "type": "string",
                        "title": "User Id"
                      },
                      "accountId": {
                        "type": "string",
                        "title": "Account Id"
                      },
                      "firstName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Name"
                      },
                      "lastName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Name"
                      },
                      "imageUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Image Url"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Email Address"
                      },
                      "cookieId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Cookie Id"
                      },
                      "locale": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Locale"
                      },
                      "countryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Country Code"
                      },
                      "referable": {
                        "type": "boolean",
                        "title": "Is Referable"
                      },
                      "firstSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Seen IP Address"
                      },
                      "lastSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Seen IP Address"
                      },
                      "dateCreated": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Created"
                      },
                      "dateBlocked": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Blocked"
                      },
                      "customFields": {
                        "$ref": "#/definitions/customFieldsContext"
                      },
                      "segments": {
                        "type": "array",
                        "title": "Segments",
                        "description": "A list of segments this user has been assigned to",
                        "items": {
                          "type": "string",
                          "title": "Segment Key",
                          "description": "A segment key this user has been assigned to (e.g. VIP)"
                        }
                      },
                      "fraudFlags": {
                        "type": "array",
                        "title": "Fraud Flags",
                        "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                        "items": {
                          "type": "object",
                          "title": "Fraud Flag",
                          "properties": {
                            "type": {
                              "type": "string",
                              "title": "Flag Type",
                              "enum": [
                                "IP",
                                "EMAIL",
                                "NAME",
                                "RATE",
                                "DAILY_REFERRAL_REWARD_LIMIT",
                                "TEMP_EMAIL",
                                "BLOCKED_USER",
                                "BLOCKED_IP"
                              ]
                            },
                            "message": {
                              "type": "string",
                              "title": "Flag Description"
                            }
                          },
                          "required": [
                            "type",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "rewards": {
                    "type": "array",
                    "title": "Referral Rewards",
                    "description": "A list of rewards associated with this referral",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "referral": {
            "type": "object",
            "title": "Referral",
            "description": "The referral associated with this referral trigger",
            "properties": {
              "id": {
                "type": "string",
                "title": "Referral Id",
                "description": "The unique identifier for this referral"
              },
              "dateReferralStarted": {
                "type": "integer",
                "title": "Date Referral Started",
                "description": "The date this referral was created (attributed)"
              },
              "referrerUser": {
                "type": "object",
                "title": "Referrer",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "User Id"
                  },
                  "accountId": {
                    "type": "string",
                    "title": "Account Id"
                  },
                  "firstName": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "First Name"
                  },
                  "lastName": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Last Name"
                  },
                  "imageUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Image Url"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Email Address"
                  },
                  "cookieId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Cookie Id"
                  },
                  "locale": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Locale"
                  },
                  "countryCode": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Country Code"
                  },
                  "referable": {
                    "type": "boolean",
                    "title": "Is Referable"
                  },
                  "firstSeenIP": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "First Seen IP Address"
                  },
                  "lastSeenIP": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "title": "Last Seen IP Address"
                  },
                  "dateCreated": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "title": "Date User Created"
                  },
                  "dateBlocked": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "title": "Date User Blocked"
                  },
                  "customFields": {
                    "$ref": "#/definitions/customFieldsContext"
                  },
                  "segments": {
                    "type": "array",
                    "title": "Segments",
                    "description": "A list of segments this user has been assigned to",
                    "items": {
                      "type": "string",
                      "title": "Segment Key",
                      "description": "A segment key this user has been assigned to (e.g. VIP)"
                    }
                  },
                  "fraudFlags": {
                    "type": "array",
                    "title": "Fraud Flags",
                    "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                    "items": {
                      "type": "object",
                      "title": "Fraud Flag",
                      "properties": {
                        "type": {
                          "type": "string",
                          "title": "Flag Type",
                          "enum": [
                            "IP",
                            "EMAIL",
                            "NAME",
                            "RATE",
                            "DAILY_REFERRAL_REWARD_LIMIT",
                            "TEMP_EMAIL",
                            "BLOCKED_USER",
                            "BLOCKED_IP"
                          ]
                        },
                        "message": {
                          "type": "string",
                          "title": "Flag Description"
                        }
                      },
                      "required": [
                        "type",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "rewards": {
                    "type": "object",
                    "title": "Rewards",
                    "description": "Rewards earned in this program by the referrer",
                    "properties": {
                      "totalCount": {
                        "type": "integer",
                        "title": "Total Count",
                        "description": "The total number of rewards earned by the referrer in this program"
                      },
                      "data": {
                        "type": "array",
                        "title": "Rewards",
                        "description": "A list of the rewards earned by the referrer in this program. (up to 20)",
                        "items": {
                          "type": "object",
                          "title": "Reward",
                          "description": "The set of reward fields",
                          "properties": {
                            "id": {
                              "type": "string",
                              "title": "Reward Id",
                              "description": "The reward identifier"
                            },
                            "dateGiven": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "title": "Date Given",
                              "description": "The date the reward was given"
                            },
                            "dateExpires": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "title": "Date Expires",
                              "description": "The date the reward expires"
                            },
                            "dateCancelled": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "title": "Date Cancelled",
                              "description": "The date the reward was cancelled"
                            },
                            "programId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "title": "Program Id",
                              "description": "The identifier of the program that generated this reward"
                            },
                            "programRewardKey": {
                              "type": "string",
                              "title": "Program Reward Key",
                              "description": "The reward key assigned by the program that generated this reward"
                            },
                            "referralId": {
                              "type": "string",
                              "title": "Referral Id",
                              "description": "The referral identifier assocaited with this reward"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "rewards": {
                "type": "array",
                "title": "Referral Rewards",
                "description": "A list of rewards associated with this referral",
                "items": {
                  "type": "object",
                  "title": "Reward",
                  "description": "The set of reward fields",
                  "properties": {
                    "id": {
                      "type": "string",
                      "title": "Reward Id",
                      "description": "The reward identifier"
                    },
                    "dateGiven": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "title": "Date Given",
                      "description": "The date the reward was given"
                    },
                    "dateExpires": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "title": "Date Expires",
                      "description": "The date the reward expires"
                    },
                    "dateCancelled": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "title": "Date Cancelled",
                      "description": "The date the reward was cancelled"
                    },
                    "programId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "title": "Program Id",
                      "description": "The identifier of the program that generated this reward"
                    },
                    "programRewardKey": {
                      "type": "string",
                      "title": "Program Reward Key",
                      "description": "The reward key assigned by the program that generated this reward"
                    },
                    "referralId": {
                      "type": "string",
                      "title": "Referral Id",
                      "description": "The referral identifier assocaited with this reward"
                    }
                  }
                }
              }
            }
          },
          "time": {
            "type": "integer",
            "title": "Trigger Time",
            "description": "The current time at the moment the program is evaluated"
          }
        },
        {
          "type": {
            "enum": [
              "AFTER_USER_EVENT_PROCESSED"
            ]
          },
          "user": {
            "title": "User Data",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "title": "User Id"
              },
              "accountId": {
                "type": "string",
                "title": "Account Id"
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Name"
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Name"
              },
              "imageUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Image Url"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Email Address"
              },
              "cookieId": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cookie Id"
              },
              "locale": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Locale"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Country Code"
              },
              "referable": {
                "type": "boolean",
                "title": "Is Referable"
              },
              "firstSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "First Seen IP Address"
              },
              "lastSeenIP": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Last Seen IP Address"
              },
              "dateCreated": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Created"
              },
              "dateBlocked": {
                "type": [
                  "integer",
                  "null"
                ],
                "title": "Date User Blocked"
              },
              "customFields": {
                "$ref": "#/definitions/customFieldsContext"
              },
              "segments": {
                "type": "array",
                "title": "Segments",
                "description": "A list of segments this user has been assigned to",
                "items": {
                  "type": "string",
                  "title": "Segment Key",
                  "description": "A segment key this user has been assigned to (e.g. VIP)"
                }
              },
              "fraudFlags": {
                "type": "array",
                "title": "Fraud Flags",
                "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                "items": {
                  "type": "object",
                  "title": "Fraud Flag",
                  "properties": {
                    "type": {
                      "type": "string",
                      "title": "Flag Type",
                      "enum": [
                        "IP",
                        "EMAIL",
                        "NAME",
                        "RATE",
                        "DAILY_REFERRAL_REWARD_LIMIT",
                        "TEMP_EMAIL",
                        "BLOCKED_USER",
                        "BLOCKED_IP"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "title": "Flag Description"
                    }
                  },
                  "required": [
                    "type",
                    "message"
                  ],
                  "additionalProperties": false
                }
              },
              "rewards": {
                "type": "object",
                "title": "Rewards",
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of rewards this user has received"
                  },
                  "data": {
                    "type": "array",
                    "title": "The Data Schema",
                    "description": "A list of the rewards this user has received (up to 20)",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "totalCount",
                  "data"
                ],
                "additionalProperties": false
              },
              "referrals": {
                "type": "object",
                "title": "The Referrals Schema",
                "required": [
                  "totalCount"
                ],
                "properties": {
                  "totalCount": {
                    "type": "integer",
                    "title": "Total Count",
                    "description": "The number of referrals this user has made"
                  }
                }
              },
              "referredByReferral": {
                "type": "object",
                "title": "Referred By Referral",
                "description": "The referral where this user was referred. Null when not a referral or partner program.",
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Referral Id",
                    "description": "The unique identifier for this referral"
                  },
                  "dateReferralStarted": {
                    "type": "integer",
                    "title": "Date Referral Started",
                    "description": "The date this referral was created (attributed)"
                  },
                  "referrerUser": {
                    "type": "object",
                    "title": "Referrer",
                    "description": "The referring user, the one that referred the current user",
                    "properties": {
                      "id": {
                        "type": "string",
                        "title": "User Id"
                      },
                      "accountId": {
                        "type": "string",
                        "title": "Account Id"
                      },
                      "firstName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Name"
                      },
                      "lastName": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Name"
                      },
                      "imageUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Image Url"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Email Address"
                      },
                      "cookieId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Cookie Id"
                      },
                      "locale": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Locale"
                      },
                      "countryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Country Code"
                      },
                      "referable": {
                        "type": "boolean",
                        "title": "Is Referable"
                      },
                      "firstSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "First Seen IP Address"
                      },
                      "lastSeenIP": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "title": "Last Seen IP Address"
                      },
                      "dateCreated": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Created"
                      },
                      "dateBlocked": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "title": "Date User Blocked"
                      },
                      "customFields": {
                        "$ref": "#/definitions/customFieldsContext"
                      },
                      "segments": {
                        "type": "array",
                        "title": "Segments",
                        "description": "A list of segments this user has been assigned to",
                        "items": {
                          "type": "string",
                          "title": "Segment Key",
                          "description": "A segment key this user has been assigned to (e.g. VIP)"
                        }
                      },
                      "fraudFlags": {
                        "type": "array",
                        "title": "Fraud Flags",
                        "description": "Flags indicating whether this user was marked as a potentially fradulent user",
                        "items": {
                          "type": "object",
                          "title": "Fraud Flag",
                          "properties": {
                            "type": {
                              "type": "string",
                              "title": "Flag Type",
                              "enum": [
                                "IP",
                                "EMAIL",
                                "NAME",
                                "RATE",
                                "DAILY_REFERRAL_REWARD_LIMIT",
                                "TEMP_EMAIL",
                                "BLOCKED_USER",
                                "BLOCKED_IP"
                              ]
                            },
                            "message": {
                              "type": "string",
                              "title": "Flag Description"
                            }
                          },
                          "required": [
                            "type",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "rewards": {
                    "type": "array",
                    "title": "Referral Rewards",
                    "description": "A list of rewards associated with this referral",
                    "items": {
                      "type": "object",
                      "title": "Reward",
                      "description": "The set of reward fields",
                      "properties": {
                        "id": {
                          "type": "string",
                          "title": "Reward Id",
                          "description": "The reward identifier"
                        },
                        "dateGiven": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Given",
                          "description": "The date the reward was given"
                        },
                        "dateExpires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Expires",
                          "description": "The date the reward expires"
                        },
                        "dateCancelled": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Date Cancelled",
                          "description": "The date the reward was cancelled"
                        },
                        "programId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "title": "Program Id",
                          "description": "The identifier of the program that generated this reward"
                        },
                        "programRewardKey": {
                          "type": "string",
                          "title": "Program Reward Key",
                          "description": "The reward key assigned by the program that generated this reward"
                        },
                        "referralId": {
                          "type": "string",
                          "title": "Referral Id",
                          "description": "The referral identifier assocaited with this reward"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "event": {
            "$ref": "#/definitions/eventContext"
          },
          "time": {
            "type": "integer",
            "title": "Trigger Time",
            "description": "The current time at the moment the program is evaluated"
          }
        }
      ]
    }
  },
  "definitions": {
    "eventContext": {
      "type": "object",
      "title": "Event",
      "description": "The variables for the event that triggered the program",
      "properties": {
        "key": {
          "type": "string",
          "title": "Event Key",
          "description": "The key of the evaluated event (e.g. purchase)"
        },
        "dateTriggered": {
          "type": "integer",
          "title": "Date Triggered",
          "description": "The date this event was created"
        },
        "fields": {
          "$ref": "#/definitions/eventFieldsContext"
        }
      }
    },
    "eventFieldsContext": {
      "type": "object",
      "title": "Event Fields",
      "description": "The body of the event (e.g. a purchase event would have fields for revenue, currency, etc.)"
    },
    "customFieldsContext": {
      "$schema": "http://json-schema.org/draft-06/schema#",
      "title": "User Custom Fields Schema",
      "description": "Defines how custom fields can be specified on a user. Allows alphanumeric numbers and underscores.",
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z0-9_]{1,64}$": {
          "$schema": "http://json-schema.org/draft-06/schema#",
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1024
            },
            {
              "type": "boolean"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "maxProperties": 100
    }
  }
}