{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/layers-com/json-schema/layers-com-partner-pending-action-schema-output-schema.json",
  "title": "PartnerPendingActionSchemaOutput",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/layers-com-openapi.json#/components/schemas/PartnerPendingActionSchemaOutput",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      "description": "Unique identifier of the pending action."
    },
    "projectId": {
      "description": "Project the action belongs to.",
      "$ref": "#/$defs/ProjectId"
    },
    "layerId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      "description": "Ads Manager project layer UUID targeted by the action."
    },
    "platform": {
      "$ref": "#/$defs/PartnerAdsPlatformEnum"
    },
    "entityType": {
      "type": "string",
      "enum": [
        "campaign",
        "adset",
        "ad",
        "adgroup",
        "keyword"
      ],
      "description": "Type of entity the action targets."
    },
    "entityId": {
      "type": "string",
      "description": "Identifier of the targeted entity."
    },
    "proposedAction": {
      "type": "object",
      "properties": {
        "actionType": {
          "type": "string",
          "description": "The kind of change being proposed."
        },
        "detail": {
          "description": "Structured parameters describing the proposed change.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        "rationale": {
          "description": "Explanation of why the change is proposed.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "actionType"
      ],
      "additionalProperties": {},
      "description": "Details of the change awaiting approval."
    },
    "requiredFlag": {
      "type": "string",
      "description": "The permission required to approve this action."
    },
    "projectedOutcome": {
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "null"
        }
      ],
      "description": "Estimated effect of applying the action, if available."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "approved",
        "rejected",
        "expired",
        "cancelled"
      ],
      "description": "Current state of the pending action."
    },
    "reason": {
      "description": "Reason recorded when the action was resolved.",
      "type": [
        "string",
        "null"
      ]
    },
    "expiresAt": {
      "description": "When the action expires if not resolved (ISO-8601 UTC).",
      "$ref": "#/$defs/IsoTimestampSchema"
    },
    "createdAt": {
      "description": "When the action was created (ISO-8601 UTC).",
      "$ref": "#/$defs/IsoTimestampSchema"
    },
    "resolvedAt": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoTimestampSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the action was approved or rejected (ISO-8601 UTC)."
    },
    "dispatchedAt": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoTimestampSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "When an approved action was sent to the platform (ISO-8601 UTC)."
    },
    "dispatchedFailureReason": {
      "description": "Error message if dispatching the approved action failed.",
      "type": [
        "string",
        "null"
      ]
    },
    "resolvedByActorType": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "user",
            "system",
            "create_agent",
            "partner"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Type of actor that resolved the action."
    },
    "resolvedByActorOrganizationId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ],
      "description": "Organization that resolved the action."
    },
    "resolvedByActorApiKeyId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ],
      "description": "API key used to resolve the action."
    }
  },
  "required": [
    "id",
    "projectId",
    "layerId",
    "platform",
    "entityType",
    "entityId",
    "proposedAction",
    "requiredFlag",
    "projectedOutcome",
    "status",
    "reason",
    "expiresAt",
    "createdAt",
    "resolvedAt",
    "dispatchedAt",
    "dispatchedFailureReason",
    "resolvedByActorType",
    "resolvedByActorOrganizationId",
    "resolvedByActorApiKeyId"
  ],
  "additionalProperties": false,
  "$defs": {
    "IsoTimestampSchema": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        {
          "type": "string",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?:Z))$"
        }
      ],
      "description": "ISO-8601 UTC timestamp with the 'Z' suffix (e.g. `2026-04-18T12:04:11Z`). Offset forms like `+00:00` are rejected with 422 VALIDATION — convert to UTC before sending. Outputs always emit `Z` so input shape matches output shape."
    },
    "PartnerAdsPlatformEnum": {
      "type": "string",
      "enum": [
        "meta",
        "tiktok",
        "apple"
      ],
      "description": "Advertising platform the campaign runs on."
    },
    "ProjectId": {
      "type": "string",
      "minLength": 5,
      "maxLength": 64,
      "pattern": "^prj_[A-Za-z0-9-]+$"
    }
  }
}