{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://torneo.ai/schemas/adaptation_attestation.v1",
  "title": "adaptation_attestation.v1",
  "description": "CH-13 and CH-27: a signed attestation of independence for one adaptation of one task class (`attestation.v1` of kind `adaptation`, issued by `attest_adaptation`). A currently VALID one admits the upstream proposal for the next season or on demand. Shape only: the Ed25519 signature, the attestor registry, the validity window, the 365-day bound and the lifecycle (suspension, revocation) stay with torneo_platform.attestations.check. The `claim` bound counts characters (500), the `conditions` bound counts canonical JSON bytes (2000) and is not expressible here.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "role",
    "subject",
    "kind",
    "claim",
    "conditions",
    "valid_from",
    "valid_until",
    "at",
    "key_id",
    "signature"
  ],
  "properties": {
    "schema": {
      "const": "attestation.v1"
    },
    "role": {
      "const": "attestation"
    },
    "kind": {
      "const": "adaptation"
    },
    "subject": {
      "type": "string",
      "description": "adaptation:<task_class>:<next_season|on_demand>; the task class is 2 to 64 characters of [a-z0-9-], starting with a letter or digit.",
      "pattern": "^adaptation:[a-z0-9][a-z0-9-]{1,63}:(next_season|on_demand)$"
    },
    "claim": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "pattern": "\\S"
    },
    "conditions": {
      "type": "object",
      "minProperties": 1,
      "description": "What the attestor declares: the task class and the adaptation, which must be those of the subject (checked by the operation, not here)."
    },
    "valid_from": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"
    },
    "valid_until": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"
    },
    "at": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"
    },
    "key_id": {
      "type": "string",
      "minLength": 1
    },
    "signature": {
      "type": "string",
      "description": "Hex Ed25519 signature over the canonical JSON of the document without it.",
      "pattern": "^[0-9a-f]{128}$"
    }
  }
}
