{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "test"
                }
              },
              "required": ["kind"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "rollback"
                },
                "promotion": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "promotion"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "deployment"
                },
                "deployment": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "deployment"],
              "additionalProperties": false
            }
          ]
        },
        "changes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "quest",
                      "quest-type",
                      "collection",
                      "quest-interactions",
                      "point-ledger",
                      "badge",
                      "offer",
                      "referral",
                      "leaderboard",
                      "tracker",
                      "engagement",
                      "image",
                      "stock-item",
                      "pickup",
                      "calendar",
                      "profile-settings",
                      "app-build"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "change": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": ["added", "changed", "archived", "unarchived"]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": ["kind", "key", "title", "change"]
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          }
        },
        "build": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "build": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["repository", "build"]
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "createdBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "const": "pending"
        }
      },
      "required": [
        "id",
        "source",
        "changes",
        "warnings",
        "build",
        "createdAt",
        "createdBy",
        "status"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "test"
                }
              },
              "required": ["kind"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "rollback"
                },
                "promotion": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "promotion"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "deployment"
                },
                "deployment": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "deployment"],
              "additionalProperties": false
            }
          ]
        },
        "changes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "quest",
                      "quest-type",
                      "collection",
                      "quest-interactions",
                      "point-ledger",
                      "badge",
                      "offer",
                      "referral",
                      "leaderboard",
                      "tracker",
                      "engagement",
                      "image",
                      "stock-item",
                      "pickup",
                      "calendar",
                      "profile-settings",
                      "app-build"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "change": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": ["added", "changed", "archived", "unarchived"]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": ["kind", "key", "title", "change"]
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          }
        },
        "build": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "build": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["repository", "build"]
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "createdBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "decidedAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "decidedBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "const": "applied"
        }
      },
      "required": [
        "id",
        "source",
        "changes",
        "warnings",
        "build",
        "createdAt",
        "createdBy",
        "decidedAt",
        "decidedBy",
        "status"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "test"
                }
              },
              "required": ["kind"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "rollback"
                },
                "promotion": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "promotion"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "deployment"
                },
                "deployment": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "deployment"],
              "additionalProperties": false
            }
          ]
        },
        "changes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "quest",
                      "quest-type",
                      "collection",
                      "quest-interactions",
                      "point-ledger",
                      "badge",
                      "offer",
                      "referral",
                      "leaderboard",
                      "tracker",
                      "engagement",
                      "image",
                      "stock-item",
                      "pickup",
                      "calendar",
                      "profile-settings",
                      "app-build"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "change": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": ["added", "changed", "archived", "unarchived"]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": ["kind", "key", "title", "change"]
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          }
        },
        "build": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "build": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["repository", "build"]
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "createdBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "decidedAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "decidedBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "const": "rejected"
        },
        "reason": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "source",
        "changes",
        "warnings",
        "build",
        "createdAt",
        "createdBy",
        "decidedAt",
        "decidedBy",
        "status",
        "reason"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "test"
                }
              },
              "required": ["kind"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "rollback"
                },
                "promotion": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "promotion"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "deployment"
                },
                "deployment": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "deployment"],
              "additionalProperties": false
            }
          ]
        },
        "changes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "quest",
                      "quest-type",
                      "collection",
                      "quest-interactions",
                      "point-ledger",
                      "badge",
                      "offer",
                      "referral",
                      "leaderboard",
                      "tracker",
                      "engagement",
                      "image",
                      "stock-item",
                      "pickup",
                      "calendar",
                      "profile-settings",
                      "app-build"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "change": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": ["added", "changed", "archived", "unarchived"]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": ["kind", "key", "title", "change"]
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          }
        },
        "build": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "build": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["repository", "build"]
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "createdBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "decidedAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "decidedBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "const": "superseded"
        }
      },
      "required": [
        "id",
        "source",
        "changes",
        "warnings",
        "build",
        "createdAt",
        "createdBy",
        "decidedAt",
        "decidedBy",
        "status"
      ],
      "additionalProperties": false
    }
  ]
}
