{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-credential-rotation-request.schema.json",
  "title": "Agent Credential Rotation Request",
  "description": "Request object for rotating or replacing an agent credential while preserving task, contract, receipt, and ledger continuity.",
  "type": "object",
  "required": [
    "rotation_request_id",
    "agent_id",
    "access_key_id",
    "reason",
    "requested_scope",
    "callback_url"
  ],
  "properties": {
    "rotation_request_id": {
      "type": "string"
    },
    "agent_id": {
      "type": "string"
    },
    "access_key_id": {
      "type": "string"
    },
    "credential_envelope_id": {
      "type": "string"
    },
    "reason": {
      "type": "string",
      "enum": [
        "scheduled_rotation",
        "scope_change",
        "callback_change",
        "suspected_exposure",
        "agent_requested",
        "operator_requested"
      ]
    },
    "requested_scope": {
      "type": "object",
      "additionalProperties": true
    },
    "callback_url": {
      "type": "string",
      "format": "uri"
    },
    "preserve_credit_account": {
      "type": "boolean"
    },
    "preserve_open_contracts": {
      "type": "boolean"
    },
    "requested_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": true
}
