{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/auth-s08-r02-c02-owner-contribution-quarantine.v1.schema.json",
  "title": "Auth S08 R02 C02 四席公开贡献隔离组装清单",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "subknifeId",
    "parentSubknife",
    "status",
    "progress",
    "boundary",
    "tool",
    "slots",
    "checks",
    "collisionDimensions",
    "rejectionCatalog",
    "outputs",
    "qaGates",
    "decision"
  ],
  "properties": {
    "schemaVersion": {
      "const": "developer.reits.tech/auth-s08-r02-c02-owner-contribution-quarantine/v1"
    },
    "subknifeId": {
      "const": "D05-A03-P03c-S08-R02-C02-H01-P03"
    },
    "parentSubknife": {
      "const": "D05-A03-P03c-S08-R02-C02-H01-P02"
    },
    "status": {
      "const": "QUARANTINE_ASSEMBLER_READY_EXTERNAL_CONTRIBUTIONS_ABSENT"
    },
    "progress": {
      "type": "object",
      "required": [
        "formal",
        "auth",
        "s08",
        "r02Engineering",
        "engineeringTools",
        "externalContributions",
        "ownerBallots"
      ],
      "properties": {
        "formal": {
          "type": "object",
          "properties": {
            "currentKnife": { "const": 5 },
            "acceptedKnives": { "const": 4 },
            "totalKnives": { "const": 36 },
            "remainingIncludingCurrent": { "const": 32 }
          },
          "required": ["currentKnife", "acceptedKnives", "totalKnives", "remainingIncludingCurrent"]
        },
        "auth": {
          "type": "object",
          "properties": {
            "completed": { "const": 7 },
            "total": { "const": 8 }
          },
          "required": ["completed", "total"]
        },
        "s08": {
          "type": "object",
          "properties": {
            "completedSteps": { "const": 1 },
            "currentStep": { "const": 2 },
            "totalSteps": { "const": 4 },
            "remainingIncludingCurrent": { "const": 3 }
          },
          "required": ["completedSteps", "currentStep", "totalSteps", "remainingIncludingCurrent"]
        },
        "r02Engineering": {
          "type": "object",
          "properties": {
            "completedSlices": { "const": 1 },
            "currentSlice": { "const": 2 },
            "totalSlices": { "const": 4 },
            "remainingIncludingCurrent": { "const": 3 }
          },
          "required": ["completedSlices", "currentSlice", "totalSlices", "remainingIncludingCurrent"]
        },
        "engineeringTools": {
          "type": "object",
          "properties": {
            "completed": { "const": 2 },
            "total": { "const": 2 },
            "ownerPreflight": { "const": 1 },
            "quarantineAssembler": { "const": 1 }
          },
          "required": ["completed", "total", "ownerPreflight", "quarantineAssembler"]
        },
        "externalContributions": {
          "$ref": "#/$defs/externalZero"
        },
        "ownerBallots": {
          "$ref": "#/$defs/ballotZero"
        }
      },
      "additionalProperties": false
    },
    "boundary": {
      "type": "object",
      "additionalProperties": { "type": ["boolean", "string"] },
      "required": [
        "executionDomain",
        "portalDistributesStaticToolOnly",
        "networkRequestsAllowed",
        "onlineUploadAllowed",
        "browserPersistenceAllowed",
        "privateMaterialAllowed",
        "rawPublicKeyAllowedOnlyInLocalProvisionalSet",
        "rawPublicKeyAllowedInReceipt",
        "authorityBindingEffect",
        "ballotEffect",
        "productionEffect",
        "formalAdvanceEffect"
      ]
    },
    "tool": {
      "type": "object",
      "additionalProperties": { "type": "string" },
      "required": [
        "name",
        "version",
        "offlineHtmlHref",
        "manifestSchemaHref",
        "contributionSchemaHref",
        "authoritySetSchemaHref",
        "cli",
        "inputMode",
        "outputMode",
        "networkBehavior",
        "persistenceBehavior",
        "nextOnPass",
        "nextOnFailure"
      ]
    },
    "slots": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "prefixItems": [
        { "$ref": "#/$defs/authSlot" },
        { "$ref": "#/$defs/securitySlot" },
        { "$ref": "#/$defs/sreDbaSlot" },
        { "$ref": "#/$defs/qaWitnessSlot" }
      ],
      "items": false
    },
    "checks": {
      "type": "array",
      "minItems": 16,
      "maxItems": 16,
      "items": { "$ref": "#/$defs/check" }
    },
    "collisionDimensions": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "label", "rule", "current"],
        "properties": {
          "id": { "enum": ["IDENTITY_REF", "KEY_REF", "PUBLIC_KEY"] },
          "label": { "type": "string" },
          "rule": { "type": "string" },
          "current": { "const": "NOT_RUN" }
        }
      }
    },
    "rejectionCatalog": {
      "type": "array",
      "minItems": 16,
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["code", "action"],
        "properties": {
          "code": { "type": "string", "pattern": "^E_[A-Z0-9_]+$" },
          "action": { "type": "string", "minLength": 8 }
        }
      }
    },
    "outputs": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "state", "containsRawPublicKey", "destination", "authorityBindingEffect"],
        "properties": {
          "id": { "enum": ["PROVISIONAL_AUTHORITY_SET", "SANITIZED_QUARANTINE_RECEIPT"] },
          "state": { "type": "string" },
          "containsRawPublicKey": { "type": "boolean" },
          "destination": { "type": "string" },
          "authorityBindingEffect": { "const": false }
        }
      }
    },
    "qaGates": {
      "type": "array",
      "minItems": 12,
      "maxItems": 12,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "name", "state"],
        "properties": {
          "id": { "type": "string", "pattern": "^G(0[1-9]|1[0-2])$" },
          "name": { "type": "string" },
          "state": { "enum": ["PASS", "WAITING", "BLOCKED", "HELD"] }
        }
      }
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "quarantineAssemblerReady",
        "externalContributionsReceived",
        "externalContributionsRequired",
        "provisionalAuthoritySetCreated",
        "authoritySetBound",
        "c02Complete",
        "c03Admitted",
        "productionHeld",
        "nextRequiredEvent"
      ],
      "properties": {
        "quarantineAssemblerReady": { "const": true },
        "externalContributionsReceived": { "const": 0 },
        "externalContributionsRequired": { "const": 4 },
        "provisionalAuthoritySetCreated": { "const": false },
        "authoritySetBound": { "const": false },
        "c02Complete": { "const": false },
        "c03Admitted": { "const": false },
        "productionHeld": { "const": true },
        "nextRequiredEvent": { "type": "string", "minLength": 20 }
      }
    }
  },
  "$defs": {
    "externalZero": {
      "type": "object",
      "additionalProperties": false,
      "required": ["required", "received", "valid", "quarantined", "bound", "waiting"],
      "properties": {
        "required": { "const": 4 },
        "received": { "const": 0 },
        "valid": { "const": 0 },
        "quarantined": { "const": 0 },
        "bound": { "const": 0 },
        "waiting": { "const": 4 }
      }
    },
    "ballotZero": {
      "type": "object",
      "additionalProperties": false,
      "required": ["required", "received", "valid", "accepted"],
      "properties": {
        "required": { "const": 4 },
        "received": { "const": 0 },
        "valid": { "const": 0 },
        "accepted": { "const": 0 }
      }
    },
    "slotBase": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sequence", "ownerId", "role", "state", "requiredArtifact", "privateMaterialAccepted"],
      "properties": {
        "sequence": { "type": "integer", "minimum": 1, "maximum": 4 },
        "ownerId": { "type": "string" },
        "role": { "type": "string" },
        "state": { "const": "EMPTY" },
        "requiredArtifact": { "const": "规范化公开贡献包" },
        "privateMaterialAccepted": { "const": false }
      }
    },
    "authSlot": {
      "allOf": [
        { "$ref": "#/$defs/slotBase" },
        { "properties": { "sequence": { "const": 1 }, "ownerId": { "const": "AUTH" } } }
      ]
    },
    "securitySlot": {
      "allOf": [
        { "$ref": "#/$defs/slotBase" },
        { "properties": { "sequence": { "const": 2 }, "ownerId": { "const": "SECURITY" } } }
      ]
    },
    "sreDbaSlot": {
      "allOf": [
        { "$ref": "#/$defs/slotBase" },
        { "properties": { "sequence": { "const": 3 }, "ownerId": { "const": "SRE_DBA" } } }
      ]
    },
    "qaWitnessSlot": {
      "allOf": [
        { "$ref": "#/$defs/slotBase" },
        { "properties": { "sequence": { "const": 4 }, "ownerId": { "const": "QA_WITNESS" } } }
      ]
    },
    "check": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "name", "failureCode"],
      "properties": {
        "id": { "type": "string", "pattern": "^Q(0[1-9]|1[0-6])$" },
        "name": { "type": "string", "minLength": 6 },
        "failureCode": { "type": "string", "pattern": "^E_[A-Z0-9_]+$" }
      }
    }
  }
}
