{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://receiz.com/governance/release-attestation.schema.v1.json",
  "title": "Receiz Release Attestation v1",
  "type": "object",
  "required": [
    "schema",
    "generatedAt",
    "commit",
    "build",
    "conformance",
    "approval",
    "governance",
    "integrity"
  ],
  "properties": {
    "schema": { "const": "receiz-release-attestation-v1" },
    "generatedAt": { "type": "string" },
    "commit": {
      "type": "object",
      "required": ["sha", "treeSha", "authorName", "authorEmail"],
      "properties": {
        "sha": { "type": "string" },
        "treeSha": { "type": "string" },
        "authorName": { "type": "string" },
        "authorEmail": { "type": "string" }
      }
    },
    "build": {
      "type": "object",
      "required": ["id", "hash"],
      "properties": {
        "id": { "type": "string" },
        "hash": { "type": "string" }
      }
    },
    "conformance": {
      "type": "object",
      "required": ["overallStatus", "reportHash", "revisionHash"],
      "properties": {
        "overallStatus": { "type": "string" },
        "reportHash": { "type": "string" },
        "revisionHash": { "type": "string" }
      }
    },
    "approval": {
      "type": "object",
      "required": ["changeClass", "approverId", "approvalRef", "riskOwnerId"],
      "properties": {
        "changeClass": { "type": "string" },
        "approverId": { "type": "string" },
        "secondApproverId": { "type": "string" },
        "approvalRef": { "type": "string" },
        "riskOwnerId": { "type": "string" }
      }
    },
    "governance": {
      "type": "object",
      "required": ["documentRegisterHash", "separationOfDuties"],
      "properties": {
        "documentRegisterHash": { "type": "string" },
        "separationOfDuties": {
          "type": "object",
          "required": ["required", "satisfied"],
          "properties": {
            "required": { "type": "boolean" },
            "satisfied": { "type": "boolean" },
            "reason": { "type": "string" }
          }
        }
      }
    },
    "integrity": {
      "type": "object",
      "required": ["payloadSha256", "signature"],
      "properties": {
        "payloadSha256": { "type": "string" },
        "signature": {
          "type": "object",
          "required": ["algorithm", "keyId", "value"],
          "properties": {
            "algorithm": { "type": "string" },
            "keyId": { "type": "string" },
            "value": { "type": "string" }
          }
        }
      }
    }
  }
}
