{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oshun.example/schemas/eve-sota-metis-view-admission.schema.json",
  "title": "Eve SOTA Metis read-view admission record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "initiativeId",
    "taskId",
    "evaluatedOn",
    "sourceEvidence",
    "policy",
    "runtimeRegistration",
    "candidates",
    "surveyTotality",
    "prerequisites",
    "governance",
    "decision",
    "limitations",
    "recordDigestSha256"
  ],
  "properties": {
    "schemaVersion": { "const": "eve-sota-metis-view-admission.v1" },
    "initiativeId": { "const": "eve-sota-gap-closure-2026-09-01" },
    "taskId": { "const": "1.3" },
    "evaluatedOn": { "const": "2026-09-01" },
    "sourceEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["authoritative", "implementation", "historicalSurvey"],
      "properties": {
        "authoritative": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/source" }
        },
        "implementation": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/source" }
        },
        "historicalSurvey": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "path",
            "recordDigestSha256",
            "currentDerivedRecordDigestSha256",
            "matchesCurrentSources"
          ],
          "properties": {
            "path": { "type": "string", "minLength": 1 },
            "recordDigestSha256": { "$ref": "#/$defs/sha256" },
            "currentDerivedRecordDigestSha256": { "$ref": "#/$defs/sha256" },
            "matchesCurrentSources": { "type": "boolean" }
          }
        }
      }
    },
    "policy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "routePrefix",
        "transportContractId",
        "exactScopeTemplate",
        "publicClassificationIds",
        "requiredCandidateIds",
        "requiredConditionIds",
        "rule"
      ],
      "properties": {
        "routePrefix": { "const": "/api/v1/eve/workbench-read" },
        "transportContractId": { "const": "eve.metis.workbench-read.v1" },
        "exactScopeTemplate": { "const": "metis:eve:read:<view>" },
        "publicClassificationIds": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "requiredCandidateIds": {
          "type": "array",
          "minItems": 7,
          "items": { "type": "string", "minLength": 1 }
        },
        "requiredConditionIds": {
          "type": "array",
          "minItems": 6,
          "items": { "type": "string", "minLength": 1 }
        },
        "rule": { "type": "string", "minLength": 1 }
      }
    },
    "runtimeRegistration": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "openApi",
        "bff",
        "historicalSurveyRegisteredViews",
        "currentSurveyRegisteredViews",
        "transportDecisionRegisteredViews",
        "zeroViewInvariant"
      ],
      "properties": {
        "openApi": { "$ref": "#/$defs/openApi" },
        "bff": { "$ref": "#/$defs/bff" },
        "historicalSurveyRegisteredViews": { "$ref": "#/$defs/stringArray" },
        "currentSurveyRegisteredViews": { "$ref": "#/$defs/stringArray" },
        "transportDecisionRegisteredViews": { "$ref": "#/$defs/stringArray" },
        "zeroViewInvariant": { "type": "boolean" }
      }
    },
    "candidates": {
      "type": "array",
      "minItems": 7,
      "items": { "$ref": "#/$defs/candidate" }
    },
    "surveyTotality": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currentPageCount",
        "consideredPageCount",
        "parkedPageCount",
        "stablePageCount",
        "omittedPageRefs",
        "duplicateCoverageAllowedForNamedCandidates",
        "pages"
      ],
      "properties": {
        "currentPageCount": { "type": "integer", "minimum": 0 },
        "consideredPageCount": { "type": "integer", "minimum": 0 },
        "parkedPageCount": { "type": "integer", "minimum": 0 },
        "stablePageCount": { "type": "integer", "minimum": 0 },
        "omittedPageRefs": { "$ref": "#/$defs/stringArray" },
        "duplicateCoverageAllowedForNamedCandidates": { "const": true },
        "pages": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/page" }
        }
      }
    },
    "prerequisites": {
      "type": "array",
      "minItems": 5,
      "items": { "$ref": "#/$defs/prerequisite" }
    },
    "governance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "transportDecisionStatus",
        "implementationAuthorized",
        "productionActivationAuthorized",
        "protectedDataAdditionalGate",
        "reviewers"
      ],
      "properties": {
        "transportDecisionStatus": { "type": "string", "minLength": 1 },
        "implementationAuthorized": { "type": "boolean" },
        "productionActivationAuthorized": { "type": "boolean" },
        "protectedDataAdditionalGate": { "type": "string", "minLength": 1 },
        "reviewers": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/reviewer" }
        }
      }
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "registeredViews",
        "registeredViewCount",
        "seamClosed",
        "gapId",
        "gapStatus",
        "implementationStarted",
        "reason",
        "deferOwner",
        "reviewTriggers"
      ],
      "properties": {
        "status": { "enum": ["zero-view-verdict", "views-registered"] },
        "registeredViews": { "$ref": "#/$defs/stringArray" },
        "registeredViewCount": { "type": "integer", "minimum": 0 },
        "seamClosed": { "type": "boolean" },
        "gapId": { "const": "G4" },
        "gapStatus": { "enum": ["open", "closed"] },
        "implementationStarted": { "type": "boolean" },
        "reason": { "type": "string", "minLength": 1 },
        "deferOwner": {
          "type": "object",
          "additionalProperties": false,
          "required": ["role", "nextLedgerOwnerTaskId", "finalReclassificationTaskId"],
          "properties": {
            "role": { "type": "string", "minLength": 1 },
            "nextLedgerOwnerTaskId": { "type": "string", "minLength": 1 },
            "finalReclassificationTaskId": { "type": "string", "minLength": 1 }
          }
        },
        "reviewTriggers": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 }
    },
    "recordDigestSha256": { "$ref": "#/$defs/sha256" }
  },
  "$defs": {
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "stringArray": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "sha256", "bytes"],
      "properties": {
        "path": { "type": "string", "minLength": 1 },
        "sha256": { "$ref": "#/$defs/sha256" },
        "bytes": { "type": "integer", "minimum": 1 }
      }
    },
    "operation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "method", "operationId", "hasResponseSchema", "security"],
      "properties": {
        "path": { "type": "string", "minLength": 1 },
        "method": { "type": "string", "minLength": 1 },
        "operationId": { "type": ["string", "null"] },
        "hasResponseSchema": { "type": "boolean" },
        "security": {
          "type": "array",
          "items": { "type": "object" }
        }
      }
    },
    "openApi": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "artifact",
        "sha256",
        "pathCount",
        "operationCount",
        "schemaCount",
        "facadePathCount",
        "facadePaths",
        "facadeOperationCount",
        "facadeOperations"
      ],
      "properties": {
        "artifact": { "type": "string", "minLength": 1 },
        "sha256": { "$ref": "#/$defs/sha256" },
        "pathCount": { "type": "integer", "minimum": 0 },
        "operationCount": { "type": "integer", "minimum": 0 },
        "schemaCount": { "type": "integer", "minimum": 0 },
        "facadePathCount": { "type": "integer", "minimum": 0 },
        "facadePaths": { "$ref": "#/$defs/stringArray" },
        "facadeOperationCount": { "type": "integer", "minimum": 0 },
        "facadeOperations": {
          "type": "array",
          "items": { "$ref": "#/$defs/operation" }
        }
      }
    },
    "view": {
      "type": "object",
      "additionalProperties": false,
      "required": ["workbench", "view", "seam"],
      "properties": {
        "workbench": { "type": "string", "minLength": 1 },
        "view": { "type": "string", "minLength": 1 },
        "seam": { "type": "string", "minLength": 1 }
      }
    },
    "bff": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source",
        "workbenchCount",
        "workbenches",
        "seamCount",
        "seams",
        "viewCount",
        "views",
        "metisWorkbenchPresent",
        "metisSeamPresent",
        "metisViews"
      ],
      "properties": {
        "source": { "type": "string", "minLength": 1 },
        "workbenchCount": { "type": "integer", "minimum": 0 },
        "workbenches": { "$ref": "#/$defs/stringArray" },
        "seamCount": { "type": "integer", "minimum": 0 },
        "seams": { "$ref": "#/$defs/stringArray" },
        "viewCount": { "type": "integer", "minimum": 0 },
        "views": { "type": "array", "items": { "$ref": "#/$defs/view" } },
        "metisWorkbenchPresent": { "type": "boolean" },
        "metisSeamPresent": { "type": "boolean" },
        "metisViews": { "type": "array", "items": { "$ref": "#/$defs/view" } }
      }
    },
    "condition": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "passed", "evidence"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "passed": { "type": "boolean" },
        "evidence": { "type": "string", "minLength": 1 }
      }
    },
    "candidate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "label",
        "discoveryRule",
        "surveyPageCount",
        "surveyPageRefs",
        "classifications",
        "apiPaths",
        "admissionConditions",
        "verdict",
        "registeredViewName",
        "exactUnblockCondition"
      ],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "label": { "type": "string", "minLength": 1 },
        "discoveryRule": { "type": "string", "minLength": 1 },
        "surveyPageCount": { "type": "integer", "minimum": 0 },
        "surveyPageRefs": { "$ref": "#/$defs/stringArray" },
        "classifications": { "$ref": "#/$defs/stringArray" },
        "apiPaths": { "$ref": "#/$defs/stringArray" },
        "admissionConditions": {
          "type": "array",
          "minItems": 6,
          "items": { "$ref": "#/$defs/condition" }
        },
        "verdict": { "enum": ["registered", "not-registered"] },
        "registeredViewName": { "type": ["string", "null"] },
        "exactUnblockCondition": { "type": "string", "minLength": 1 }
      }
    },
    "page": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "page",
        "source",
        "sourceSha256",
        "seamAdmission",
        "classifications",
        "authz",
        "apiPaths"
      ],
      "properties": {
        "page": { "type": "string", "minLength": 1 },
        "source": { "type": "string", "minLength": 1 },
        "sourceSha256": { "$ref": "#/$defs/sha256" },
        "seamAdmission": { "type": "string", "minLength": 1 },
        "classifications": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "authz": { "type": "string", "minLength": 1 },
        "apiPaths": { "$ref": "#/$defs/stringArray" }
      }
    },
    "prerequisite": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "state", "ownerTaskId", "condition"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "state": { "type": "string", "minLength": 1 },
        "ownerTaskId": { "type": "string", "minLength": 1 },
        "condition": { "type": "string", "minLength": 1 }
      }
    },
    "reviewer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["role", "status"],
      "properties": {
        "role": { "type": "string", "minLength": 1 },
        "status": { "type": "string", "minLength": 1 }
      }
    }
  }
}
