{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developers.ecocitizenz.com/schemas/action-envelopes/ap2-ucp-readiness.schema.json",
  "title": "ECZ-ID AP2/UCP Checkout-Readiness Metadata",
  "description": "Optional readiness metadata describing how an agentic-commerce checkout handoff to TrustOps can carry AP2/UCP-style context. This is readiness and routing metadata only: it is not a new passport, not an endorsement, and not approved by Google, Shopify, or any platform. ECZ-ID does not validate an agent owner's external mandate as a purchase gate; external mandate or reference metadata may be carried as optional, non-authoritative receipt context. An agent is never blocked merely because it is an agent. A buyer or an authorised paying agent may confirm; payment and eligibility rules still apply; payment never creates proof by itself.",
  "type": "object",
  "required": ["type", "version", "checkout_handoff", "policy"],
  "additionalProperties": false,
  "properties": {
    "type": { "const": "ecz.ap2_ucp_readiness" },
    "version": { "type": "string" },
    "checkout_handoff": {
      "type": "object",
      "description": "Where the machine-readable checkout handoff happens. The Developer Gateway documents it; TrustOps performs it.",
      "required": ["trustops_manifest", "trustops_checkout_intent"],
      "properties": {
        "trustops_manifest": { "type": "string", "format": "uri" },
        "trustops_url_analyse": { "type": "string", "format": "uri" },
        "trustops_checkout_intent": { "type": "string", "format": "uri" },
        "payment_methods": {
          "type": "array",
          "items": { "type": "string", "enum": ["card"] },
          "description": "Currently card. Other methods appear here only when live in TrustOps."
        },
        "billing_frequencies": {
          "type": "array",
          "items": { "type": "string", "enum": ["monthly", "annual"] }
        }
      },
      "additionalProperties": false
    },
    "external_mandate_context": {
      "type": "object",
      "description": "Optional, non-authoritative receipt context. Missing AP2/UCP/A2A/ACP metadata does not block checkout, and present metadata is not validated as a purchase gate.",
      "properties": {
        "scheme": { "type": "string", "description": "For example ap2, ucp, acp, or another external scheme name." },
        "reference": { "type": "string" },
        "authoritative": { "const": false }
      },
      "additionalProperties": false
    },
    "confirmation": {
      "type": "object",
      "description": "Who may confirm the selection before checkout.",
      "properties": {
        "buyer_may_confirm": { "const": true },
        "authorised_paying_agent_may_confirm": { "const": true }
      },
      "additionalProperties": false
    },
    "policy": {
      "type": "object",
      "required": [
        "not_a_passport",
        "not_an_endorsement",
        "not_platform_approved",
        "payment_is_not_proof",
        "agent_type_checkout_gate",
        "ap2_mandate_checkout_gate"
      ],
      "properties": {
        "not_a_passport": { "const": true },
        "not_an_endorsement": { "const": true },
        "not_platform_approved": { "const": true },
        "payment_is_not_proof": { "const": true },
        "agent_type_checkout_gate": { "const": false },
        "ap2_mandate_checkout_gate": { "const": false },
        "eligibility_rules_still_apply": { "const": true },
        "recheck_before_reliance": { "const": true },
        "local_policy_decides": { "const": true }
      },
      "additionalProperties": false
    }
  }
}
