{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ktapeout.org/spec/ktapeout-profile-descriptor-v1.schema.json",
  "title": "KTAPEOUT Profile Descriptor V1",
  "description": "Tooling descriptor for a bounded Profile. The 0.5.0 English specification remains normative.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "protocol_semver", "profile_id", "profile_semver", "status", "state_encoding", "transition", "clock", "resource_envelope", "capabilities", "evidence"],
  "properties": {
    "schema": {"const": "KTAPEOUT-PROFILE-DESCRIPTOR-V1"},
    "protocol_semver": {"const": "0.5.0"},
    "profile_id": {"type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"},
    "profile_semver": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
    "status": {"enum": ["local-only", "declared", "tn10-admitted", "mainnet-admitted"]},
    "state_encoding": {"type": "object", "additionalProperties": false, "required": ["format", "input_schema", "output_schema", "canonicalization"], "properties": {"format": {"type": "string", "minLength": 1, "maxLength": 128}, "input_schema": {"type": "string", "minLength": 1, "maxLength": 256}, "output_schema": {"type": "string", "minLength": 1, "maxLength": 256}, "canonicalization": {"type": "string", "minLength": 1, "maxLength": 256}}},
    "transition": {"type": "object", "additionalProperties": false, "required": ["equation", "deterministic", "predecessor_binding", "successor_binding"], "properties": {"equation": {"type": "string", "minLength": 1, "maxLength": 1024}, "deterministic": {"const": true}, "predecessor_binding": {"type": "string", "minLength": 1, "maxLength": 256}, "successor_binding": {"type": "string", "minLength": 1, "maxLength": 256}}},
    "clock": {"type": "object", "additionalProperties": false, "required": ["unit", "step_bound"], "properties": {"unit": {"type": "string", "minLength": 1, "maxLength": 64}, "step_bound": {"type": "integer", "minimum": 1, "maximum": 1000000}}},
    "resource_envelope": {"type": "object", "additionalProperties": false, "required": ["units", "max_bytes", "max_steps"], "properties": {"units": {"type": "string", "minLength": 1, "maxLength": 64}, "max_bytes": {"type": "integer", "minimum": 1, "maximum": 268435456}, "max_steps": {"type": "integer", "minimum": 1, "maximum": 1000000}}},
    "capabilities": {"type": "object", "additionalProperties": false, "required": ["fund", "step", "migrate"], "properties": {"fund": {"type": "boolean"}, "step": {"type": "boolean"}, "migrate": {"type": "boolean"}}},
    "evidence": {"type": "object", "additionalProperties": false, "required": ["proof_level", "vector_root", "semantics_hash"], "properties": {"proof_level": {"enum": ["none", "local", "reference", "testnet"]}, "vector_root": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "semantics_hash": {"type": "string", "pattern": "^[0-9a-f]{64}$"}}}
  }
}
