{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Author Intent Layer (AIL) 1.0.0 — public proposal JSON Schema",
  "$id": "https://authorintentlayer.org/schemas/ail-v1.0.schema.json",
  "type": "object",
  "required": [
    "spec",
    "spec_version",
    "record_id",
    "document",
    "declaration",
    "intent",
    "claims",
    "interpretation_boundaries",
    "use_constraints",
    "verification"
  ],
  "properties": {
    "spec": {
      "const": "Author Intent Layer"
    },
    "spec_version": {
      "type": "string",
      "pattern": "^1\\.0\\.[0-9]+$"
    },
    "record_id": {
      "type": "string",
      "minLength": 1,
      "pattern": "\\S"
    },
    "document": {
      "type": "object",
      "required": [
        "url",
        "title",
        "language",
        "revision_id"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "language": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "publication_date": {
          "type": "string",
          "format": "date"
        },
        "revision_id": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{64}$"
        }
      },
      "additionalProperties": false
    },
    "declaration": {
      "type": "object",
      "required": [
        "attributed_to",
        "status",
        "authentication"
      ],
      "properties": {
        "attributed_to": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "status": {
          "enum": [
            "author-declared",
            "editor-declared"
          ]
        },
        "authentication": {
          "enum": [
            "not-verified",
            "verified"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date"
        }
      },
      "additionalProperties": false
    },
    "intent": {
      "type": "object",
      "required": [
        "central_question",
        "central_thesis",
        "conceptual_distinction",
        "argument_path",
        "open_question"
      ],
      "properties": {
        "central_question": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "central_thesis": {
          "$ref": "#/$defs/thesis"
        },
        "conceptual_distinction": {
          "type": "object",
          "required": [
            "id",
            "a",
            "b"
          ],
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            },
            "a": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            },
            "b": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          },
          "additionalProperties": false
        },
        "argument_path": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "open_question": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        }
      },
      "additionalProperties": false
    },
    "claims": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/claim"
      }
    },
    "interpretation_boundaries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "description",
          "anchor"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "anchor": {
            "$ref": "#/$defs/anchor"
          }
        },
        "additionalProperties": false
      }
    },
    "use_constraints": {
      "type": "object",
      "required": [
        "is_descriptive_metadata",
        "is_instruction_to_ai",
        "may_be_critically_challenged",
        "may_not_override_reader_request"
      ],
      "properties": {
        "is_descriptive_metadata": {
          "type": "boolean"
        },
        "is_instruction_to_ai": {
          "type": "boolean"
        },
        "may_be_critically_challenged": {
          "type": "boolean"
        },
        "may_not_override_reader_request": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "verification": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "enum": [
            "not_run",
            "completed",
            "partial"
          ]
        },
        "note": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "thesis": {
      "type": "object",
      "required": [
        "id",
        "text"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "text": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        }
      },
      "additionalProperties": false
    },
    "anchor": {
      "type": "object",
      "required": [
        "selector",
        "exact"
      ],
      "properties": {
        "selector": {
          "const": "TextQuoteSelector"
        },
        "exact": {
          "type": "string",
          "minLength": 5,
          "pattern": "\\S"
        }
      },
      "additionalProperties": false
    },
    "claim": {
      "type": "object",
      "required": [
        "id",
        "type",
        "text",
        "role",
        "anchors"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "type": {
          "enum": [
            "empirical",
            "interpretation",
            "hypothesis",
            "normative",
            "illustration"
          ]
        },
        "text": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "role": {
          "enum": [
            "problem",
            "distinction",
            "central_mechanism",
            "principle",
            "conclusion",
            "support",
            "qualification"
          ]
        },
        "anchors": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/anchor"
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
