{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Proposed source-backed research contribution",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "claim", "contributor", "submitted_at", "sources", "limitations", "status", "license", "license_consent", "history"],
  "properties": {
    "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9-]+$"},
    "claim": {"type": "string", "minLength": 1},
    "contributor": {
      "type": "object", "additionalProperties": false,
      "required": ["display_name", "profile_url", "identity_status"],
      "properties": {
        "display_name": {"type": "string", "minLength": 1},
        "profile_url": {"type": "string", "pattern": "^https://"},
        "identity_status": {"enum": ["self_reported", "account_attributed"]}
      }
    },
    "submitted_at": {"type": "string", "format": "date-time", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$"},
    "sources": {
      "type": "array", "minItems": 1,
      "items": {
        "type": "object", "additionalProperties": false,
        "required": ["url", "locator", "supports", "kind", "rights_note"],
        "properties": {
          "url": {"type": "string", "pattern": "^https?://"},
          "locator": {"type": "string", "minLength": 1},
          "supports": {"type": "string", "minLength": 1},
          "kind": {"enum": ["primary_document", "legal_allegation", "judicial_finding", "reporting", "patent", "film", "other"]},
          "rights_note": {"type": "string", "minLength": 1}
        }
      }
    },
    "limitations": {"type": "string", "minLength": 1},
    "status": {"const": "proposed"},
    "license": {"const": "CC-BY-SA-4.0"},
    "license_consent": {"const": true},
    "supersedes": {"type": ["string", "null"]},
    "history": {
      "type": "array", "maxItems": 0,
      "description": "Review events are added by the trusted review workflow, not asserted by an incoming submission."
    }
  }
}
