{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agenthandelstandard.se/schemas/agent-lane.schema.json",
  "title": "SACP agent lane declaration",
  "description": "How an agent identifies itself and declares its phase in the machine-readable agent lane. Added in SACP 1.2.0-draft. Sent as the request property agent, or as the headers SACP-Agent-Id, SACP-Agent-Phase and SACP-Checkout-Mode. If both are present they must match.",
  "type": "object",
  "required": [
    "agent_phase"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "description": "Stable identifier for this agent. Required when the shop advertises agent.lane."
    },
    "name": {
      "type": "string"
    },
    "agent_phase": {
      "enum": [
        "shopping",
        "checkout"
      ],
      "description": "shopping is discovery, browsing, comparison, cart building and recommendation, with no financial commitment. checkout is the agent executing or initiating a payment or an order commitment."
    },
    "checkout_mode": {
      "enum": [
        "human_handoff",
        "autonomous"
      ],
      "description": "Required when agent_phase is checkout. human_handoff issues a checkout URL for a person to confirm. autonomous asks the shop to commit without a further human payment confirmation, and is allowed only when the shop advertises checkout.autonomous and a mandate covers the exact terms."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "agent_phase": {
            "const": "checkout"
          }
        },
        "required": [
          "agent_phase"
        ]
      },
      "then": {
        "required": [
          "checkout_mode"
        ]
      }
    }
  ]
}
