{
  "$comment": "GENERATED FILE — DO NOT EDIT DIRECTLY. Source: packages/schemas/src. Regenerate with `npm run generate:json-schema --workspace=@spacecorp/schemas`.",
  "$id": "https://spacecorp.io/schemas/fact.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^fact-[a-z0-9][a-z0-9-]*$"
    },
    "project": {
      "type": "string",
      "pattern": "^scp-[a-z0-9][a-z0-9-]*$"
    },
    "subject": {
      "type": "string",
      "minLength": 1
    },
    "property": {
      "type": "string",
      "minLength": 1
    },
    "value": {
      "type": [
        "string",
        "number",
        "boolean",
        "null"
      ]
    },
    "unit": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "derivation": {
      "type": "object",
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "transcribed",
            "measured",
            "calculated",
            "inferred",
            "ai-assisted"
          ]
        },
        "formula": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "input_fact_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^fact-[a-z0-9][a-z0-9-]*$"
          }
        }
      },
      "required": [
        "method",
        "formula",
        "input_fact_ids"
      ],
      "additionalProperties": false
    },
    "verification": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "unknown",
            "unverified",
            "verified",
            "conflicting"
          ]
        },
        "checked_at": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "checked_by": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "state",
        "checked_at",
        "checked_by"
      ],
      "additionalProperties": false
    },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": "string",
            "pattern": "^src-[a-z0-9][a-z0-9-]*$"
          },
          "locator": {
            "type": "object",
            "properties": {
              "page": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "section": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "table": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "figure": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "url_fragment": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "page",
              "section",
              "table",
              "figure",
              "url_fragment"
            ],
            "additionalProperties": false
          },
          "evidence_note": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "source_id",
          "locator",
          "evidence_note"
        ],
        "additionalProperties": false
      }
    },
    "confidence": {
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low",
        "unknown"
      ]
    }
  },
  "required": [
    "schema_version",
    "id",
    "subject",
    "property",
    "value",
    "unit",
    "derivation",
    "verification",
    "evidence",
    "confidence"
  ],
  "additionalProperties": false
}
