{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gships.dammonburden.com/review-packets/schemas/decision-bundle-v1.json",
  "title": "GShips offline independent-review decision bundle",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "templateStatus",
    "boundary",
    "packetId",
    "packetFingerprint",
    "releaseId",
    "sourceCommit",
    "templateFingerprint",
    "bundleId",
    "reviewer",
    "aiAssistance",
    "decisions",
    "bundleFingerprint"
  ],
  "properties": {
    "schemaVersion": {
      "const": "gships-review-decision-bundle-1"
    },
    "templateStatus": {
      "const": "completed-offline"
    },
    "boundary": {
      "type": "string",
      "minLength": 20
    },
    "packetId": {
      "type": "string",
      "minLength": 3
    },
    "packetFingerprint": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "releaseId": {
      "type": "string",
      "minLength": 3
    },
    "sourceCommit": {
      "type": "string",
      "pattern": "^(development|[a-f0-9]{40})$"
    },
    "templateFingerprint": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "bundleId": {
      "type": "string",
      "minLength": 8
    },
    "reviewer": {
      "$ref": "#/$defs/reviewer"
    },
    "aiAssistance": {
      "$ref": "#/$defs/aiAssistance"
    },
    "bundleFingerprint": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "decisions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/decision"
      }
    }
  },
  "$defs": {
    "fingerprint": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "identityAttestation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "attestationId",
        "attestedByRole",
        "attestedAt"
      ],
      "properties": {
        "status": {
          "const": "verified-distinct-human"
        },
        "attestationId": {
          "type": "string",
          "minLength": 8
        },
        "attestedByRole": {
          "type": "string",
          "minLength": 5
        },
        "attestedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "qualificationAttestation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "attestationId",
        "scopeCode",
        "status",
        "basis",
        "attestedByRole",
        "attestedAt"
      ],
      "properties": {
        "attestationId": {
          "type": "string",
          "minLength": 8
        },
        "scopeCode": {
          "enum": [
            "affected-public-rights",
            "ai-knowledge-assurance",
            "accessibility-disability-justice",
            "closed-loop-systems",
            "clinical-health",
            "communications-navigation",
            "culture-education",
            "defensive-cyber-safety",
            "dual-use-risk",
            "ecology-food",
            "ecosystem-due-diligence",
            "editorial-governance",
            "ethics-planetary-protection",
            "event-access-freshness",
            "governance-law-rights",
            "human-factors",
            "information-science",
            "institution-building",
            "manufacturing-maintenance",
            "mission-physics",
            "nuclear-safety",
            "opportunity-eligibility-access",
            "propulsion-energy",
            "radiation-health-physics",
            "reproductive-health-rights",
            "security-assurance",
            "structures-safety",
            "systems-engineering",
            "visual-science-communication"
          ]
        },
        "status": {
          "const": "qualified"
        },
        "basis": {
          "type": "string",
          "minLength": 40
        },
        "attestedByRole": {
          "type": "string",
          "minLength": 5
        },
        "attestedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "prohibitedRelationships": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "employee",
        "investor",
        "customer",
        "sponsor",
        "sourceAuthor",
        "salesperson",
        "directlySupervisedCollaborator",
        "affectedDecisionMaker"
      ],
      "properties": {
        "employee": {
          "const": false
        },
        "investor": {
          "const": false
        },
        "customer": {
          "const": false
        },
        "sponsor": {
          "const": false
        },
        "sourceAuthor": {
          "const": false
        },
        "salesperson": {
          "const": false
        },
        "directlySupervisedCollaborator": {
          "const": false
        },
        "affectedDecisionMaker": {
          "const": false
        }
      }
    },
    "publicationConsent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publicReviewerId",
        "publicLabel",
        "publicAttribution",
        "scope",
        "qualificationSummary",
        "independenceSummary",
        "conflictSummary",
        "compensationSummary",
        "decisions"
      ],
      "properties": {
        "publicReviewerId": {
          "type": "boolean"
        },
        "publicLabel": {
          "type": "boolean"
        },
        "publicAttribution": {
          "type": "boolean"
        },
        "scope": {
          "type": "boolean"
        },
        "qualificationSummary": {
          "type": "boolean"
        },
        "independenceSummary": {
          "type": "boolean"
        },
        "conflictSummary": {
          "type": "boolean"
        },
        "compensationSummary": {
          "type": "boolean"
        },
        "decisions": {
          "type": "boolean"
        }
      }
    },
    "reviewer": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "reviewerPublicId",
        "publicLabel",
        "publicAttribution",
        "identityAttestation",
        "scopeCodes",
        "scopeStatement",
        "qualificationBasis",
        "qualificationAttestations",
        "independence",
        "conflicts",
        "compensation",
        "publicationConsent"
      ],
      "properties": {
        "reviewerPublicId": {
          "type": "string",
          "minLength": 8
        },
        "publicLabel": {
          "type": "string",
          "minLength": 3
        },
        "publicAttribution": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "minLength": 3
            }
          ]
        },
        "identityAttestation": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/identityAttestation"
            }
          ]
        },
        "scopeCodes": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "affected-public-rights",
              "ai-knowledge-assurance",
              "accessibility-disability-justice",
              "closed-loop-systems",
              "clinical-health",
              "communications-navigation",
              "culture-education",
              "defensive-cyber-safety",
              "dual-use-risk",
              "ecology-food",
              "ecosystem-due-diligence",
              "editorial-governance",
              "ethics-planetary-protection",
              "event-access-freshness",
              "governance-law-rights",
              "human-factors",
              "information-science",
              "institution-building",
              "manufacturing-maintenance",
              "mission-physics",
              "nuclear-safety",
              "opportunity-eligibility-access",
              "propulsion-energy",
              "radiation-health-physics",
              "reproductive-health-rights",
              "security-assurance",
              "structures-safety",
              "systems-engineering",
              "visual-science-communication"
            ]
          }
        },
        "scopeStatement": {
          "type": "string"
        },
        "qualificationBasis": {
          "type": "string"
        },
        "qualificationAttestations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/qualificationAttestation"
          }
        },
        "independence": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "determinationId",
            "assessedAt",
            "assessedForRecordIds",
            "basis",
            "prohibitedRelationships",
            "otherRelationships"
          ],
          "properties": {
            "status": {
              "enum": [
                "independent",
                "recused"
              ]
            },
            "determinationId": {
              "type": "string",
              "minLength": 8
            },
            "assessedAt": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "format": "date-time"
                }
              ]
            },
            "assessedForRecordIds": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            },
            "basis": {
              "type": "string"
            },
            "prohibitedRelationships": {
              "$ref": "#/$defs/prohibitedRelationships"
            },
            "otherRelationships": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "conflicts": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "assessedAt",
            "declarations",
            "publicSummary",
            "managementDeterminationId"
          ],
          "properties": {
            "status": {
              "enum": [
                "none-identified",
                "managed-nonmaterial",
                "recuse"
              ]
            },
            "assessedAt": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "format": "date-time"
                }
              ]
            },
            "declarations": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "publicSummary": {
              "type": "string"
            },
            "managementDeterminationId": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "minLength": 8
                }
              ]
            }
          }
        },
        "compensation": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "assessedAt",
            "payer",
            "terms",
            "outcomeContingent",
            "publicSummary"
          ],
          "properties": {
            "status": {
              "enum": [
                "uncompensated",
                "fixed-not-outcome-contingent"
              ]
            },
            "assessedAt": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "format": "date-time"
                }
              ]
            },
            "payer": {
              "type": "string"
            },
            "terms": {
              "type": "string"
            },
            "outcomeContingent": {
              "const": false
            },
            "publicSummary": {
              "type": "string"
            }
          }
        },
        "publicationConsent": {
          "$ref": "#/$defs/publicationConsent"
        }
      }
    },
    "aiAssistance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "used",
        "purposes",
        "humanVerification"
      ],
      "properties": {
        "used": {
          "type": "boolean"
        },
        "purposes": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "retrieval",
              "translation",
              "comparison",
              "copyediting",
              "summarization",
              "other"
            ]
          }
        },
        "humanVerification": {
          "type": "string"
        }
      }
    },
    "scopeAssignment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "groupId",
        "scopeCode",
        "qualificationAttestationId"
      ],
      "properties": {
        "groupId": {
          "type": "string",
          "minLength": 1
        },
        "scopeCode": {
          "enum": [
            "affected-public-rights",
            "ai-knowledge-assurance",
            "accessibility-disability-justice",
            "closed-loop-systems",
            "clinical-health",
            "communications-navigation",
            "culture-education",
            "defensive-cyber-safety",
            "dual-use-risk",
            "ecology-food",
            "ecosystem-due-diligence",
            "editorial-governance",
            "ethics-planetary-protection",
            "event-access-freshness",
            "governance-law-rights",
            "human-factors",
            "information-science",
            "institution-building",
            "manufacturing-maintenance",
            "mission-physics",
            "nuclear-safety",
            "opportunity-eligibility-access",
            "propulsion-energy",
            "radiation-health-physics",
            "reproductive-health-rights",
            "security-assurance",
            "structures-safety",
            "systems-engineering",
            "visual-science-communication"
          ]
        },
        "qualificationAttestationId": {
          "type": "string",
          "minLength": 8
        }
      }
    },
    "externalSource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "title",
        "url",
        "publisher",
        "publishedAt",
        "accessedAt",
        "contentFingerprint",
        "metadataFingerprint"
      ],
      "properties": {
        "title": {
          "type": "string",
          "minLength": 3
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "publisher": {
          "type": "string",
          "minLength": 2
        },
        "publishedAt": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "date"
            }
          ]
        },
        "accessedAt": {
          "type": "string",
          "format": "date-time"
        },
        "contentFingerprint": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/fingerprint"
            }
          ]
        },
        "metadataFingerprint": {
          "$ref": "#/$defs/fingerprint"
        }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sourceId",
        "sourceFingerprint",
        "externalSource",
        "locator",
        "finding",
        "relation"
      ],
      "properties": {
        "sourceId": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "minLength": 1
            }
          ]
        },
        "sourceFingerprint": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/fingerprint"
            }
          ]
        },
        "externalSource": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/externalSource"
            }
          ]
        },
        "locator": {
          "type": "string",
          "minLength": 12
        },
        "finding": {
          "type": "string",
          "minLength": 20
        },
        "relation": {
          "enum": [
            "supports",
            "contradicts",
            "qualifies",
            "context",
            "current-status",
            "identity",
            "eligibility",
            "access",
            "date",
            "risk",
            "correction"
          ]
        }
      },
      "oneOf": [
        {
          "properties": {
            "sourceId": {
              "type": "string"
            },
            "sourceFingerprint": {
              "$ref": "#/$defs/fingerprint"
            },
            "externalSource": {
              "type": "null"
            }
          }
        },
        {
          "properties": {
            "sourceId": {
              "type": "null"
            },
            "sourceFingerprint": {
              "type": "null"
            },
            "externalSource": {
              "$ref": "#/$defs/externalSource"
            }
          }
        }
      ]
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "decisionId",
        "recordType",
        "recordId",
        "recordFingerprint",
        "disposition",
        "scopeAssignments",
        "coveredDomainCodes",
        "scopeStatement",
        "decidedAt",
        "confidence",
        "rationale",
        "evidence",
        "inaccessibleMaterial",
        "proposedCorrections",
        "whatWouldChange",
        "recusalReasonCode",
        "recusalPublicSummary",
        "supersedesDecisionId"
      ],
      "properties": {
        "decisionId": {
          "type": "string",
          "minLength": 8
        },
        "recordType": {
          "type": "string",
          "minLength": 1
        },
        "recordId": {
          "type": "string",
          "minLength": 1
        },
        "recordFingerprint": {
          "$ref": "#/$defs/fingerprint"
        },
        "disposition": {
          "enum": [
            "approve",
            "revise",
            "contest",
            "reject",
            "recuse"
          ]
        },
        "scopeAssignments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/scopeAssignment"
          }
        },
        "coveredDomainCodes": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "affected-public-rights",
              "ai-knowledge-assurance",
              "accessibility-disability-justice",
              "closed-loop-systems",
              "clinical-health",
              "communications-navigation",
              "culture-education",
              "defensive-cyber-safety",
              "dual-use-risk",
              "ecology-food",
              "ecosystem-due-diligence",
              "editorial-governance",
              "ethics-planetary-protection",
              "event-access-freshness",
              "governance-law-rights",
              "human-factors",
              "information-science",
              "institution-building",
              "manufacturing-maintenance",
              "mission-physics",
              "nuclear-safety",
              "opportunity-eligibility-access",
              "propulsion-energy",
              "radiation-health-physics",
              "reproductive-health-rights",
              "security-assurance",
              "structures-safety",
              "systems-engineering",
              "visual-science-communication"
            ]
          }
        },
        "scopeStatement": {
          "type": "string"
        },
        "decidedAt": {
          "type": "string",
          "format": "date-time"
        },
        "confidence": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "enum": [
                "strong",
                "supported",
                "tentative",
                "contested",
                "unverified"
              ]
            }
          ]
        },
        "rationale": {
          "type": "string"
        },
        "evidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/evidence"
          }
        },
        "inaccessibleMaterial": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "sourceId",
              "reasonCode",
              "publicNote"
            ],
            "properties": {
              "sourceId": {
                "type": "string"
              },
              "reasonCode": {
                "enum": [
                  "paywall",
                  "access-denied",
                  "missing",
                  "format",
                  "other"
                ]
              },
              "publicNote": {
                "type": "string"
              }
            }
          }
        },
        "proposedCorrections": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "field",
              "proposedChange",
              "reason"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "proposedChange": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        },
        "whatWouldChange": {
          "type": "string"
        },
        "recusalReasonCode": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "enum": [
                "conflict",
                "scope-limit",
                "capacity",
                "access",
                "safety",
                "other"
              ]
            }
          ]
        },
        "recusalPublicSummary": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string"
            }
          ]
        },
        "supersedesDecisionId": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "minLength": 8
            }
          ]
        }
      }
    }
  }
}
