{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tyrvar.com/schemas/trust-profile-export-1.2.json",
  "$defs": {
    "ExportAnswer": {
      "properties": {
        "answer_id": {
          "format": "uuid",
          "title": "Answer Id",
          "type": "string"
        },
        "canonical_key": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportCanonicalKey"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "question_text": {
          "title": "Question Text",
          "type": "string"
        },
        "text": {
          "title": "Text",
          "type": "string"
        },
        "answer_version": {
          "description": "Revision counter: 1 = never saved after creation; +1 per saved edit (a save with unchanged text still counts)",
          "title": "Answer Version",
          "type": "integer"
        },
        "origin": {
          "enum": [
            "inherited",
            "ai_generated",
            "manual"
          ],
          "title": "Origin",
          "type": "string"
        },
        "assurance": {
          "description": "Where the claim comes from (1.1); docs/TRUST-PROFILE-EXPORT.md",
          "enum": [
            "inherited_platform",
            "inherited_confirmed",
            "evidenced",
            "asserted",
            "unreviewed"
          ],
          "title": "Assurance",
          "type": "string"
        },
        "status": {
          "description": "draft | pending_approval | approved | rejected | escalated",
          "title": "Status",
          "type": "string"
        },
        "needs_review": {
          "title": "Needs Review",
          "type": "boolean"
        },
        "review_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Review Reason"
        },
        "approval": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportApproval"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Present only when status is approved"
        },
        "effective_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Effective Date"
        },
        "review_due_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Review Due Date"
        },
        "last_reviewed_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Last Reviewed At"
        },
        "created_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        },
        "sensitivity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Sensitivity"
        },
        "permitted_reuse": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Permitted Reuse"
        },
        "restrictions": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Restrictions"
        },
        "known_exceptions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Known Exceptions"
        },
        "caveats": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Caveats"
        },
        "evidence": {
          "items": {
            "$ref": "#/$defs/ExportEvidenceReference"
          },
          "title": "Evidence",
          "type": "array"
        },
        "inheritance": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportInheritance"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "report_citations": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ExportReportCitation"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Null when report_citations_included is false",
          "title": "Report Citations"
        }
      },
      "required": [
        "answer_id",
        "question_text",
        "text",
        "answer_version",
        "origin",
        "assurance",
        "status",
        "needs_review"
      ],
      "title": "ExportAnswer",
      "type": "object"
    },
    "ExportApproval": {
      "properties": {
        "approved_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportPerson"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "approved_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Approved At"
        },
        "requested_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Requested At"
        },
        "notes": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Notes"
        }
      },
      "title": "ExportApproval",
      "type": "object"
    },
    "ExportCanonicalKey": {
      "properties": {
        "key_code": {
          "title": "Key Code",
          "type": "string"
        },
        "label": {
          "title": "Label",
          "type": "string"
        },
        "question": {
          "title": "Question",
          "type": "string"
        },
        "is_archived": {
          "title": "Is Archived",
          "type": "boolean"
        }
      },
      "required": [
        "key_code",
        "label",
        "question",
        "is_archived"
      ],
      "title": "ExportCanonicalKey",
      "type": "object"
    },
    "ExportCompositionStatement": {
      "properties": {
        "position": {
          "title": "Position",
          "type": "integer"
        },
        "statement_id": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Statement Id"
        },
        "declaration_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Declaration Key"
        },
        "provenance": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "platform_guarantee | confirmed",
          "title": "Provenance"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        },
        "vendor_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Vendor Name"
        },
        "confirmed_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportPerson"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "confirmed_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Confirmed At"
        },
        "source_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Source Label"
        }
      },
      "required": [
        "position"
      ],
      "title": "ExportCompositionStatement",
      "type": "object"
    },
    "ExportEvidenceReference": {
      "properties": {
        "id": {
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "file_name": {
          "title": "File Name",
          "type": "string"
        },
        "document_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Document Type"
        },
        "version": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Version"
        },
        "is_current_version": {
          "title": "Is Current Version",
          "type": "boolean"
        },
        "issue_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Issue Date"
        },
        "expiration_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Expiration Date"
        },
        "file_size_bytes": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "File Size Bytes"
        },
        "platform_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Platform Name"
        },
        "is_redistributable": {
          "title": "Is Redistributable",
          "type": "boolean"
        },
        "redistribution_restriction": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Redistribution Restriction"
        },
        "nda_required": {
          "title": "Nda Required",
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "file_name",
        "is_current_version",
        "is_redistributable",
        "nda_required"
      ],
      "title": "ExportEvidenceReference",
      "type": "object"
    },
    "ExportInheritance": {
      "properties": {
        "platform_id": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Platform Id"
        },
        "platform_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Platform Name"
        },
        "composition": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ExportCompositionStatement"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Null when no per-statement record describes the current text",
          "title": "Composition"
        }
      },
      "title": "ExportInheritance",
      "type": "object"
    },
    "ExportPerson": {
      "properties": {
        "id": {
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Null when the user is not a member of the exporting company",
          "title": "Name"
        }
      },
      "required": [
        "id"
      ],
      "title": "ExportPerson",
      "type": "object"
    },
    "ExportProfile": {
      "properties": {
        "id": {
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Description"
        },
        "product_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Product Type"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Status"
        },
        "company_id": {
          "format": "uuid",
          "title": "Company Id",
          "type": "string"
        },
        "company_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Company Name"
        },
        "question_set_version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Question Set Version"
        }
      },
      "required": [
        "id",
        "company_id"
      ],
      "title": "ExportProfile",
      "type": "object"
    },
    "ExportReportCitation": {
      "properties": {
        "evidence_id": {
          "format": "uuid",
          "title": "Evidence Id",
          "type": "string"
        },
        "criterion_id": {
          "title": "Criterion Id",
          "type": "string"
        },
        "section_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Section Label"
        },
        "pages": {
          "items": {
            "type": "integer"
          },
          "title": "Pages",
          "type": "array"
        },
        "report_issue_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Report Issue Date"
        },
        "nda_required": {
          "title": "Nda Required",
          "type": "boolean"
        },
        "confirmed_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExportPerson"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "confirmed_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Confirmed At"
        },
        "source_label": {
          "title": "Source Label",
          "type": "string"
        }
      },
      "required": [
        "evidence_id",
        "criterion_id",
        "nda_required",
        "source_label"
      ],
      "title": "ExportReportCitation",
      "type": "object"
    },
    "ExportUnansweredQuestion": {
      "properties": {
        "key_code": {
          "title": "Key Code",
          "type": "string"
        },
        "question": {
          "title": "Question",
          "type": "string"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "key_code",
        "question"
      ],
      "title": "ExportUnansweredQuestion",
      "type": "object"
    }
  },
  "properties": {
    "export_schema_version": {
      "default": "1.2",
      "title": "Export Schema Version",
      "type": "string"
    },
    "exported_at": {
      "format": "date-time",
      "title": "Exported At",
      "type": "string"
    },
    "exported_by": {
      "$ref": "#/$defs/ExportPerson"
    },
    "profile": {
      "$ref": "#/$defs/ExportProfile"
    },
    "report_citations_included": {
      "title": "Report Citations Included",
      "type": "boolean"
    },
    "answer_count": {
      "title": "Answer Count",
      "type": "integer"
    },
    "unanswered_count": {
      "title": "Unanswered Count",
      "type": "integer"
    },
    "excluded": {
      "additionalProperties": {
        "type": "integer"
      },
      "description": "Records left out on purpose, by reason",
      "title": "Excluded",
      "type": "object"
    },
    "answers": {
      "items": {
        "$ref": "#/$defs/ExportAnswer"
      },
      "title": "Answers",
      "type": "array"
    },
    "unanswered_questions": {
      "items": {
        "$ref": "#/$defs/ExportUnansweredQuestion"
      },
      "title": "Unanswered Questions",
      "type": "array"
    }
  },
  "required": [
    "exported_at",
    "exported_by",
    "profile",
    "report_citations_included",
    "answer_count",
    "unanswered_count",
    "answers"
  ],
  "title": "Tyrvar trust profile export, format 1.2",
  "type": "object"
}
