{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://work.mathchast.com/schemas/research-ledger-proposed-v1.json",
  "title": "SRC-10 research-ledger v1.0 PROPOSED",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "normative_status",
    "research_id",
    "article_id",
    "author_id",
    "workflow_gate",
    "question",
    "required_information",
    "search_scope",
    "sources",
    "evidence",
    "claims",
    "target_changes",
    "conclusion"
  ],
  "properties": {
    "schema_version": {
      "const": "src10.research-ledger.v1.0-proposed"
    },
    "normative_status": {
      "const": "PROPOSED"
    },
    "research_id": {
      "$ref": "#/$defs/id"
    },
    "article_id": {
      "type": "string",
      "minLength": 1
    },
    "author_id": {
      "type": "string",
      "minLength": 1
    },
    "workflow_gate": {
      "const": "BLOCKED_SOURCE_REPAIR"
    },
    "question": {
      "type": "string",
      "minLength": 12
    },
    "required_information": {
      "type": "string",
      "minLength": 1
    },
    "search_scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "geography",
        "temporal_start",
        "temporal_end",
        "searched_at"
      ],
      "properties": {
        "geography": {
          "type": "string",
          "minLength": 1
        },
        "temporal_start": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "temporal_end": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "searched_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source"
      }
    },
    "evidence": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "claims": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/claim"
      }
    },
    "target_changes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/change"
      }
    },
    "conclusion": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "rationale"
      ],
      "properties": {
        "status": {
          "enum": [
            "PASS",
            "REVIEW",
            "BLOCKED",
            "NOT_RUN"
          ]
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{1,63}$"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source_id",
        "url",
        "title",
        "publisher",
        "source_type",
        "published_on",
        "updated_on",
        "accessed_at",
        "geography",
        "temporal_scope",
        "method",
        "reliability_basis",
        "limitations"
      ],
      "properties": {
        "source_id": {
          "$ref": "#/$defs/id"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "publisher": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_type": {
          "enum": [
            "PRIMARY",
            "OFFICIAL",
            "PEER_REVIEWED",
            "TECHNICAL_DOCUMENTATION",
            "INDUSTRY_EXPERT",
            "SECONDARY",
            "ORIGINAL_PROVENANCE",
            "OTHER"
          ]
        },
        "published_on": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "updated_on": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "accessed_at": {
          "type": "string",
          "format": "date-time"
        },
        "geography": {
          "type": "string",
          "minLength": 1
        },
        "temporal_scope": {
          "type": "string",
          "minLength": 1
        },
        "method": {
          "type": "string",
          "minLength": 1
        },
        "reliability_basis": {
          "type": "string",
          "minLength": 1
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "evidence_id",
        "source_id",
        "locator",
        "excerpt",
        "relation",
        "observed_at"
      ],
      "properties": {
        "evidence_id": {
          "$ref": "#/$defs/id"
        },
        "source_id": {
          "$ref": "#/$defs/id"
        },
        "locator": {
          "type": "string",
          "minLength": 1
        },
        "excerpt": {
          "type": "string",
          "minLength": 8
        },
        "relation": {
          "enum": [
            "SUPPORTS",
            "CONTRADICTS",
            "CONTEXT",
            "REFUTES"
          ]
        },
        "observed_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "reviewer_id",
        "checked_at",
        "method",
        "evidence_refs",
        "rationale"
      ],
      "properties": {
        "state": {
          "enum": [
            "NOT_REVIEWED",
            "INDEPENDENT_REVIEWED"
          ]
        },
        "reviewer_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "method": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          }
        },
        "rationale": {
          "type": "string"
        }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "claim_id",
        "category",
        "statement",
        "origin",
        "verification_status",
        "evidence_refs",
        "conditions",
        "geography",
        "temporal_scope",
        "conflict_group",
        "number_registry_ref",
        "recommendation_basis",
        "review"
      ],
      "properties": {
        "claim_id": {
          "$ref": "#/$defs/id"
        },
        "category": {
          "enum": [
            "FACT",
            "NUMBER",
            "RECOMMENDATION",
            "SAFETY",
            "REGIONAL_APPLICABILITY"
          ]
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "origin": {
          "enum": [
            "SOURCE_ORIGINAL",
            "EXTERNAL_RESEARCH"
          ]
        },
        "source_block_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "verification_status": {
          "enum": [
            "SUPPORTED",
            "CONFLICTED",
            "UNCONFIRMED",
            "REFUTED"
          ]
        },
        "evidence_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          }
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "geography": {
          "type": "string",
          "minLength": 1
        },
        "temporal_scope": {
          "type": "string",
          "minLength": 1
        },
        "conflict_group": {
          "type": [
            "string",
            "null"
          ]
        },
        "number_registry_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "recommendation_basis": {
          "type": [
            "string",
            "null"
          ]
        },
        "review": {
          "$ref": "#/$defs/review"
        }
      }
    },
    "change": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "claim_id",
        "action",
        "article_locator",
        "rationale"
      ],
      "properties": {
        "claim_id": {
          "$ref": "#/$defs/id"
        },
        "action": {
          "enum": [
            "ADD",
            "MODIFY",
            "NO_CHANGE",
            "REJECT",
            "HOLD"
          ]
        },
        "article_locator": {
          "type": "string",
          "minLength": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "claims": {
            "contains": {
              "properties": {
                "verification_status": {
                  "const": "CONFLICTED"
                }
              }
            }
          }
        }
      },
      "then": {
        "properties": {
          "conclusion": {
            "properties": {
              "status": {
                "enum": [
                  "REVIEW",
                  "BLOCKED",
                  "NOT_RUN"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "claims": {
            "contains": {
              "properties": {
                "verification_status": {
                  "enum": [
                    "UNCONFIRMED",
                    "REFUTED"
                  ]
                }
              }
            }
          }
        }
      },
      "then": {
        "properties": {
          "conclusion": {
            "properties": {
              "status": {
                "enum": [
                  "REVIEW",
                  "BLOCKED",
                  "NOT_RUN"
                ]
              }
            }
          }
        }
      }
    }
  ]
}
