{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "X1 Financial Safety Preparedness Packet v1.0.0",
  "additionalProperties": false,
  "properties": {
    "assessment": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "domain": {
            "maxLength": 100,
            "type": "string"
          },
          "evidence_refs": {
            "items": {
              "maxLength": 2000,
              "type": "string"
            },
            "maxItems": 0,
            "type": "array"
          },
          "observed_at": {
            "maxLength": 30,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
            "type": "string"
          },
          "provenance": {
            "const": "self_report"
          },
          "question_id": {
            "enum": [
              "callback",
              "payment",
              "authentication",
              "recovery",
              "awareness",
              "support",
              "trusted_contact",
              "authority",
              "continuity",
              "records"
            ]
          },
          "response": {
            "enum": [
              "yes",
              "no",
              "unsure",
              "skip",
              "na"
            ]
          },
          "status": {
            "enum": [
              "reported_in_place",
              "needs_checking",
              "action_suggested",
              "not_assessed"
            ]
          }
        },
        "required": [
          "domain",
          "evidence_refs",
          "observed_at",
          "provenance",
          "question_id",
          "response",
          "status"
        ],
        "type": "object"
      },
      "maxItems": 10,
      "type": "array"
    },
    "contact_roles": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "backup": {
            "maxLength": 100,
            "type": "string"
          },
          "method": {
            "maxLength": 100,
            "type": "string"
          },
          "name": {
            "maxLength": 100,
            "type": "string"
          },
          "provenance": {
            "const": "user_supplied_unverified"
          },
          "role": {
            "maxLength": 100,
            "type": "string"
          },
          "source": {
            "maxLength": 100,
            "type": "string"
          },
          "verified_date": {
            "maxLength": 100,
            "type": "string"
          }
        },
        "required": [
          "backup",
          "method",
          "name",
          "provenance",
          "role",
          "source",
          "verified_date"
        ],
        "type": "object"
      },
      "maxItems": 1,
      "type": "array"
    },
    "generated_at": {
      "maxLength": 30,
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
      "type": "string"
    },
    "jurisdiction": {
      "enum": [
        "unknown",
        "US",
        "other"
      ]
    },
    "kind": {
      "const": "financial_safety_preparedness_packet"
    },
    "limitations": {
      "items": {
        "maxLength": 2000,
        "type": "string"
      },
      "maxItems": 5,
      "type": "array"
    },
    "permissions": {
      "additionalProperties": false,
      "properties": {
        "external_actions_authorized": {
          "const": false
        },
        "external_sharing_authorized": {
          "const": false
        },
        "note": {
          "maxLength": 2000,
          "type": "string"
        },
        "storage_authorized": {
          "const": false
        }
      },
      "required": [
        "external_actions_authorized",
        "external_sharing_authorized",
        "note",
        "storage_authorized"
      ],
      "type": "object"
    },
    "practice": {
      "additionalProperties": false,
      "properties": {
        "choices": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "choice": {
                "enum": [
                  "pause",
                  "send",
                  "instructions",
                  "helper",
                  "known",
                  "supplied",
                  "institution",
                  "alternate",
                  "assume",
                  "protect",
                  "share",
                  "recovery_fee"
                ]
              },
              "step": {
                "enum": [
                  "request",
                  "callback",
                  "unreachable",
                  "secrecy",
                  "sent"
                ]
              }
            },
            "required": [
              "choice",
              "step"
            ],
            "type": "object"
          },
          "maxItems": 5,
          "type": "array"
        },
        "completed": {
          "type": "boolean"
        },
        "included": {
          "type": "boolean"
        },
        "interpretation": {
          "maxLength": 2000,
          "type": "string"
        }
      },
      "required": [
        "choices",
        "completed",
        "included",
        "interpretation"
      ],
      "type": "object"
    },
    "priorities": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "completion_criterion": {
            "maxLength": 2000,
            "type": "string"
          },
          "completion_evidence": {
            "type": "null"
          },
          "id": {
            "enum": [
              "callback",
              "payment",
              "authentication",
              "recovery",
              "awareness",
              "support",
              "trusted_contact",
              "authority",
              "continuity",
              "records"
            ]
          },
          "owner": {
            "const": "You choose"
          },
          "rationale": {
            "maxLength": 2000,
            "type": "string"
          },
          "rule_version": {
            "const": "1.0.0"
          },
          "source_refs": {
            "items": {
              "maxLength": 100,
              "type": "string"
            },
            "maxItems": 5,
            "type": "array"
          },
          "status": {
            "const": "proposed"
          },
          "suggested_step": {
            "maxLength": 2000,
            "type": "string"
          },
          "target_date": {
            "type": "null"
          },
          "title": {
            "maxLength": 2000,
            "type": "string"
          },
          "trigger": {
            "additionalProperties": false,
            "properties": {
              "question_id": {
                "enum": [
                  "callback",
                  "payment",
                  "authentication",
                  "recovery",
                  "awareness",
                  "support",
                  "trusted_contact",
                  "authority",
                  "continuity",
                  "records"
                ]
              },
              "response": {
                "enum": [
                  "yes",
                  "no",
                  "unsure",
                  "skip",
                  "na"
                ]
              }
            },
            "required": [
              "question_id",
              "response"
            ],
            "type": "object"
          }
        },
        "required": [
          "completion_criterion",
          "completion_evidence",
          "id",
          "owner",
          "rationale",
          "rule_version",
          "source_refs",
          "status",
          "suggested_step",
          "target_date",
          "title",
          "trigger"
        ],
        "type": "object"
      },
      "maxItems": 3,
      "type": "array"
    },
    "privacy": {
      "additionalProperties": false,
      "properties": {
        "included_sections": {
          "items": {
            "enum": [
              "routine",
              "worksheets",
              "assessment",
              "priorities",
              "contacts",
              "practice"
            ]
          },
          "maxItems": 6,
          "type": "array"
        },
        "retention_note": {
          "maxLength": 2000,
          "type": "string"
        },
        "secrets_policy": {
          "maxLength": 2000,
          "type": "string"
        }
      },
      "required": [
        "included_sections",
        "retention_note",
        "secrets_policy"
      ],
      "type": "object"
    },
    "purpose": {
      "const": "education_and_preparedness"
    },
    "routine": {
      "items": {
        "maxLength": 2000,
        "type": "string"
      },
      "maxItems": 4,
      "type": "array"
    },
    "schema_version": {
      "const": "1.0.0"
    },
    "source_refs": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "checked_at": {
            "maxLength": 10,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string"
          },
          "id": {
            "maxLength": 100,
            "type": "string"
          },
          "title": {
            "maxLength": 100,
            "type": "string"
          },
          "url": {
            "maxLength": 300,
            "pattern": "^https://",
            "type": "string"
          }
        },
        "required": [
          "checked_at",
          "id",
          "title",
          "url"
        ],
        "type": "object"
      },
      "maxItems": 10,
      "type": "array"
    },
    "worksheets": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "prompts": {
            "items": {
              "maxLength": 2000,
              "type": "string"
            },
            "maxItems": 3,
            "type": "array"
          },
          "title": {
            "maxLength": 100,
            "type": "string"
          }
        },
        "required": [
          "prompts",
          "title"
        ],
        "type": "object"
      },
      "maxItems": 4,
      "type": "array"
    }
  },
  "required": [
    "assessment",
    "contact_roles",
    "generated_at",
    "jurisdiction",
    "kind",
    "limitations",
    "permissions",
    "practice",
    "priorities",
    "privacy",
    "purpose",
    "routine",
    "schema_version",
    "source_refs",
    "worksheets"
  ],
  "type": "object"
}
