{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "/schemas/3.1.0-rc.4/brand/creative-approval-response.json",
  "title": "Creative Approval Response",
  "description": "Response from the approval_webhook after reviewing a submitted creative. Uses discriminated union on `approval_status` field: approved, rejected, or pending_review.",
  "type": "object",
  "allOf": [
    {
      "$ref": "/schemas/3.1.0-rc.4/core/version-envelope.json"
    },
    {
      "$ref": "/schemas/3.1.0-rc.4/core/protocol-envelope.json"
    }
  ],
  "oneOf": [
    {
      "title": "CreativeApproved",
      "properties": {
        "approval_status": {
          "type": "string",
          "const": "approved",
          "description": "Creative has been approved for distribution. Renamed from `status` in 3.1 to free the top-level `status` key for the envelope task-status (TaskStatus) under MCP flat-on-the-wire serialization (#4878)."
        },
        "rights_id": {
          "type": "string",
          "x-entity": "rights_grant"
        },
        "creative_id": {
          "type": "string",
          "description": "Echo of the buyer's creative identifier",
          "x-entity": "creative"
        },
        "creative_url": {
          "type": "string",
          "format": "uri"
        },
        "approved_at": {
          "type": "string",
          "format": "date-time"
        },
        "conditions": {
          "type": "array",
          "description": "Conditions on the approval (e.g., 'approved for NL market only')",
          "items": {
            "type": "string"
          }
        },
        "context": {
          "$ref": "/schemas/3.1.0-rc.4/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
        }
      },
      "required": [
        "approval_status",
        "rights_id"
      ],
      "additionalProperties": true,
      "not": {
        "required": [
          "errors"
        ]
      }
    },
    {
      "title": "CreativeRejected",
      "properties": {
        "approval_status": {
          "type": "string",
          "const": "rejected",
          "description": "Creative was rejected"
        },
        "rights_id": {
          "type": "string",
          "x-entity": "rights_grant"
        },
        "creative_id": {
          "type": "string",
          "description": "Echo of the buyer's creative identifier",
          "x-entity": "creative"
        },
        "creative_url": {
          "type": "string",
          "format": "uri"
        },
        "reason": {
          "type": "string",
          "description": "Why the creative was rejected"
        },
        "suggestions": {
          "type": "array",
          "description": "Actionable feedback for revision. If present, the buyer can revise and resubmit the creative. If absent, the rejection is final for this creative concept.",
          "items": {
            "type": "string"
          }
        },
        "context": {
          "$ref": "/schemas/3.1.0-rc.4/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
        }
      },
      "required": [
        "approval_status",
        "rights_id",
        "reason"
      ],
      "additionalProperties": true,
      "not": {
        "required": [
          "errors"
        ]
      }
    },
    {
      "title": "CreativePendingReview",
      "properties": {
        "approval_status": {
          "type": "string",
          "const": "pending_review",
          "description": "Creative is queued for review"
        },
        "rights_id": {
          "type": "string",
          "x-entity": "rights_grant"
        },
        "creative_id": {
          "type": "string",
          "description": "Echo of the buyer's creative identifier",
          "x-entity": "creative"
        },
        "creative_url": {
          "type": "string",
          "format": "uri"
        },
        "estimated_response_time": {
          "type": "string",
          "description": "Expected time for review (e.g., '24h', '2 business days')"
        },
        "status_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to poll for updated approval status. GET this URL to receive a creative-approval-response. Poll at reasonable intervals (suggested: every 5 minutes, back off after 1 hour to every 30 minutes). Stop polling after estimated_response_time has elapsed and the approval_status is still pending_review."
        },
        "context": {
          "$ref": "/schemas/3.1.0-rc.4/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
        }
      },
      "required": [
        "approval_status",
        "rights_id"
      ],
      "additionalProperties": true,
      "not": {
        "required": [
          "errors"
        ]
      }
    },
    {
      "title": "CreativeApprovalError",
      "properties": {
        "errors": {
          "type": "array",
          "items": {
            "$ref": "/schemas/3.1.0-rc.4/core/error.json"
          },
          "minItems": 1
        },
        "context": {
          "$ref": "/schemas/3.1.0-rc.4/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
        }
      },
      "required": [
        "errors"
      ],
      "additionalProperties": true,
      "not": {
        "anyOf": [
          {
            "required": [
              "approval_status"
            ]
          }
        ]
      }
    }
  ],
  "properties": {}
}
