{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/auth-s08-r02-c02-authority-binding-readiness.v1.schema.json",
  "title": "Auth S08 R02 C02 四席外部权威绑定就绪回执",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "subknifeId",
    "parentSubknife",
    "status",
    "dossier",
    "progress",
    "truthBoundary",
    "intakeContract",
    "seats",
    "validationPipeline",
    "rejectionRules",
    "permissions",
    "effects",
    "decision"
  ],
  "properties": {
    "schemaVersion": {
      "const": "developer.reits.tech/auth-s08-r02-c02-authority-binding-readiness/v1"
    },
    "subknifeId": {
      "const": "D05-A03-P03c-S08-R02-C02"
    },
    "parentSubknife": {
      "const": "D05-A03-P03c-S08-R02-C01"
    },
    "status": {
      "const": "IMPORTER_READY_EXTERNAL_AUTHORITY_SET_ABSENT_PRODUCTION_HELD"
    },
    "dossier": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "digest"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "digest": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "progress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "formal",
        "auth",
        "s08",
        "r02Engineering",
        "authorities"
      ],
      "properties": {
        "formal": {
          "$ref": "#/$defs/formalProgress"
        },
        "auth": {
          "$ref": "#/$defs/completionProgress"
        },
        "s08": {
          "$ref": "#/$defs/stageProgress"
        },
        "r02Engineering": {
          "$ref": "#/$defs/engineeringProgress"
        },
        "authorities": {
          "$ref": "#/$defs/authorityProgress"
        }
      }
    },
    "truthBoundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "onlyPublicIdentityAndKeyMaterialAccepted",
        "rawPublicKeyPersistedInReadinessReceipt",
        "privateMaterialAccepted",
        "portalCanCreateAuthority",
        "portalCanSign",
        "ciCanSign",
        "codexCanSign",
        "proxyAllowed",
        "authoritySetIsBallot",
        "authoritySetIsExecutionPermit",
        "fourBindingsOnlyAdmitBallotIntake"
      ],
      "minProperties": 11,
      "maxProperties": 11,
      "properties": {
        "onlyPublicIdentityAndKeyMaterialAccepted": {
          "const": true
        },
        "rawPublicKeyPersistedInReadinessReceipt": {
          "const": false
        },
        "privateMaterialAccepted": {
          "const": false
        },
        "portalCanCreateAuthority": {
          "const": false
        },
        "portalCanSign": {
          "const": false
        },
        "ciCanSign": {
          "const": false
        },
        "codexCanSign": {
          "const": false
        },
        "proxyAllowed": {
          "const": false
        },
        "authoritySetIsBallot": {
          "const": false
        },
        "authoritySetIsExecutionPermit": {
          "const": false
        },
        "fourBindingsOnlyAdmitBallotIntake": {
          "const": true
        }
      }
    },
    "intakeContract": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "authoritySetSchemaHref",
        "readinessSchemaHref",
        "apiHref",
        "cli",
        "inputMode",
        "outputMode",
        "signatureAlgorithm",
        "publicKeyEncoding",
        "ownerOrder"
      ],
      "properties": {
        "authoritySetSchemaHref": {
          "const": "/schemas/auth-s08-owner-authority-set.v1.schema.json"
        },
        "readinessSchemaHref": {
          "const": "/schemas/auth-s08-r02-c02-authority-binding-readiness.v1.schema.json"
        },
        "apiHref": {
          "const": "/api/d05-auth-authority-binding-readiness"
        },
        "cli": {
          "type": "string",
          "minLength": 40
        },
        "inputMode": {
          "const": "READ_ONLY_LOCAL_FILE"
        },
        "outputMode": {
          "const": "SANITIZED_FINGERPRINT_RECEIPT"
        },
        "signatureAlgorithm": {
          "const": "ED25519"
        },
        "publicKeyEncoding": {
          "const": "BASE64URL_32_BYTES"
        },
        "ownerOrder": {
          "type": "array",
          "prefixItems": [
            {
              "const": "AUTH"
            },
            {
              "const": "SECURITY"
            },
            {
              "const": "SRE_DBA"
            },
            {
              "const": "QA_WITNESS"
            }
          ],
          "items": false,
          "minItems": 4,
          "maxItems": 4
        }
      }
    },
    "seats": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "prefixItems": [
        {
          "$ref": "#/$defs/authSeat"
        },
        {
          "$ref": "#/$defs/securitySeat"
        },
        {
          "$ref": "#/$defs/sreDbaSeat"
        },
        {
          "$ref": "#/$defs/qaWitnessSeat"
        }
      ],
      "items": false
    },
    "validationPipeline": {
      "type": "array",
      "minItems": 12,
      "maxItems": 12,
      "items": {
        "$ref": "#/$defs/validationStep"
      }
    },
    "rejectionRules": {
      "type": "array",
      "minItems": 12,
      "maxItems": 12,
      "items": {
        "$ref": "#/$defs/rejectionRule"
      }
    },
    "permissions": {
      "type": "object",
      "minProperties": 8,
      "maxProperties": 8,
      "additionalProperties": {
        "const": false
      }
    },
    "effects": {
      "type": "object",
      "minProperties": 14,
      "maxProperties": 14,
      "additionalProperties": {
        "const": 0
      }
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "intakeVerifierImplemented",
        "safeEmptyStatePublished",
        "externalAuthoritySetPresent",
        "externalAuthoritySetBound",
        "ballotIntakeAdmitted",
        "productionHeld",
        "nextRequiredEvent"
      ],
      "properties": {
        "intakeVerifierImplemented": {
          "const": true
        },
        "safeEmptyStatePublished": {
          "const": true
        },
        "externalAuthoritySetPresent": {
          "const": false
        },
        "externalAuthoritySetBound": {
          "const": false
        },
        "ballotIntakeAdmitted": {
          "const": false
        },
        "productionHeld": {
          "const": true
        },
        "nextRequiredEvent": {
          "type": "string",
          "minLength": 20
        }
      }
    }
  },
  "$defs": {
    "formalProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currentKnife",
        "acceptedKnives",
        "totalKnives",
        "remainingIncludingCurrent"
      ],
      "properties": {
        "currentKnife": {
          "const": 5
        },
        "acceptedKnives": {
          "const": 4
        },
        "totalKnives": {
          "const": 36
        },
        "remainingIncludingCurrent": {
          "const": 32
        }
      }
    },
    "completionProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "completed",
        "total"
      ],
      "properties": {
        "completed": {
          "const": 7
        },
        "total": {
          "const": 8
        }
      }
    },
    "stageProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "completedSteps",
        "currentStep",
        "totalSteps",
        "remainingIncludingCurrent"
      ],
      "properties": {
        "completedSteps": {
          "const": 1
        },
        "currentStep": {
          "const": 2
        },
        "totalSteps": {
          "const": 4
        },
        "remainingIncludingCurrent": {
          "const": 3
        }
      }
    },
    "engineeringProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "completedSlices",
        "currentSlice",
        "totalSlices",
        "remainingIncludingCurrent"
      ],
      "properties": {
        "completedSlices": {
          "const": 1
        },
        "currentSlice": {
          "const": 2
        },
        "totalSlices": {
          "const": 4
        },
        "remainingIncludingCurrent": {
          "const": 3
        }
      }
    },
    "authorityProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "required",
        "received",
        "valid",
        "bound",
        "waiting"
      ],
      "properties": {
        "required": {
          "const": 4
        },
        "received": {
          "const": 0
        },
        "valid": {
          "const": 0
        },
        "bound": {
          "const": 0
        },
        "waiting": {
          "const": 4
        }
      }
    },
    "seatBase": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ownerId",
        "role",
        "state",
        "identityRef",
        "keyRef",
        "publicKeyFingerprint",
        "validation"
      ],
      "properties": {
        "ownerId": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "state": {
          "const": "ABSENT"
        },
        "identityRef": {
          "type": "null"
        },
        "keyRef": {
          "type": "null"
        },
        "publicKeyFingerprint": {
          "type": "null"
        },
        "validation": {
          "const": "NOT_RUN"
        }
      }
    },
    "authSeat": {
      "allOf": [
        {
          "$ref": "#/$defs/seatBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "AUTH"
            }
          }
        }
      ]
    },
    "securitySeat": {
      "allOf": [
        {
          "$ref": "#/$defs/seatBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "SECURITY"
            }
          }
        }
      ]
    },
    "sreDbaSeat": {
      "allOf": [
        {
          "$ref": "#/$defs/seatBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "SRE_DBA"
            }
          }
        }
      ]
    },
    "qaWitnessSeat": {
      "allOf": [
        {
          "$ref": "#/$defs/seatBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "QA_WITNESS"
            }
          }
        }
      ]
    },
    "validationStep": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "failure"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^A(0[1-9]|1[0-2])$"
        },
        "name": {
          "type": "string",
          "minLength": 8
        },
        "failure": {
          "const": "REJECT_AND_HOLD_PRODUCTION"
        }
      }
    },
    "rejectionRule": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "trigger",
        "action"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AR(0[1-9]|1[0-2])$"
        },
        "trigger": {
          "type": "string",
          "minLength": 8
        },
        "action": {
          "enum": [
            "WAIT_AND_HOLD_PRODUCTION",
            "REJECT_AND_HOLD_PRODUCTION"
          ]
        }
      }
    }
  }
}
