{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thesoftwarelens.com/saacip/0.2/schemas/attestation.schema.json",
  "$comment": "SaaCIP 0.2 (https://thesoftwarelens.com/saacip/). Licensed under the Apache License 2.0.",
  "title": "SaaCIP 0.2 attestation",
  "description": "The hub's signed record of a statement it accepted and of the outcomes it recorded for the hire (section 7.7). Returned in the statement response. Added in 0.2.",
  "type": "object",
  "required": [
    "protocol",
    "agent_id",
    "statement_hash",
    "final",
    "recorded",
    "signed_at",
    "hub_public_key",
    "signature"
  ],
  "properties": {
    "protocol": {
      "$ref": "common.schema.json#/$defs/protocol"
    },
    "agent_id": {
      "type": "string",
      "description": "The hub's identifier for the capability in this hire."
    },
    "statement_hash": {
      "$ref": "common.schema.json#/$defs/sha256Hex",
      "description": "SHA-256 of the canonical JSON of the statement the hub accepted."
    },
    "final": {
      "type": "boolean"
    },
    "recorded": {
      "type": "object",
      "required": [
        "reported",
        "judged",
        "accepted",
        "rejected",
        "actions_approved",
        "actions_rejected"
      ],
      "properties": {
        "reported": {
          "type": "integer",
          "minimum": 0
        },
        "judged": {
          "type": "integer",
          "minimum": 0
        },
        "accepted": {
          "type": "integer",
          "minimum": 0
        },
        "rejected": {
          "type": "integer",
          "minimum": 0
        },
        "actions_approved": {
          "type": "integer",
          "minimum": 0
        },
        "actions_rejected": {
          "type": "integer",
          "minimum": 0
        }
      },
      "description": "The hub's own counts for the hire, from its record, not copied from the statement. Where they differ from the statement, the difference is a fact for a registry to record."
    },
    "signed_at": {
      "$ref": "common.schema.json#/$defs/epochSeconds"
    },
    "hub_public_key": {
      "$ref": "common.schema.json#/$defs/base64",
      "description": "The Ed25519 key this attestation verifies with; the one returned at enrolment."
    },
    "signature": {
      "$ref": "common.schema.json#/$defs/base64",
      "description": "Ed25519 over the canonical JSON of the attestation without signature."
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext"
    }
  }
}
