{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://authorintentlayer.org/schemas/ail-v1.1.schema.json",
  "title": "Author Intent Layer 1.1.0: Embedded-first public proposal",
  "description": "Machine-readable declaration of authorial intent, not an instruction to the reader or AI.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "spec",
    "spec_version",
    "document",
    "intent"
  ],
  "properties": {
    "spec": {
      "const": "Author Intent Layer"
    },
    "spec_version": {
      "const": "1.1.0"
    },
    "record_id": {
      "type": "string",
      "minLength": 1
    },
    "document": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "language"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "minLength": 8
        },
        "language": {
          "type": "string",
          "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
        },
        "title": {
          "type": "string"
        },
        "publication_date": {
          "type": "string",
          "format": "date"
        },
        "revision_id": {
          "type": "string"
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{64}$"
        }
      }
    },
    "declaration": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attributed_to": {
          "type": "string"
        },
        "status": {
          "enum": [
            "author-declared",
            "editor-declared"
          ]
        },
        "authentication": {
          "enum": [
            "not-verified",
            "verified"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "intent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "central_question",
        "central_thesis"
      ],
      "properties": {
        "central_question": {
          "type": "string",
          "minLength": 1
        },
        "central_thesis": {
          "$ref": "#/$defs/thesis"
        },
        "conceptual_distinction": {
          "$ref": "#/$defs/distinction"
        },
        "argument_path": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "open_question": {
          "type": "string"
        }
      }
    },
    "claims": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/claim"
      }
    },
    "interpretation_boundaries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/boundary"
      }
    },
    "use_constraints": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "is_descriptive_metadata": {
          "const": true
        },
        "is_instruction_to_ai": {
          "const": false
        },
        "may_be_critically_challenged": {
          "const": true
        },
        "may_not_override_reader_request": {
          "const": true
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "not_run",
            "completed",
            "partial"
          ]
        },
        "note": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "thesis": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "text"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "text": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "distinction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "a",
        "b"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "a": {
          "type": "string",
          "minLength": 1
        },
        "b": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "anchor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "selector",
        "exact"
      ],
      "properties": {
        "selector": {
          "const": "TextQuoteSelector"
        },
        "exact": {
          "type": "string",
          "minLength": 5
        }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "text"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "text": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "enum": [
            "empirical",
            "interpretation",
            "hypothesis",
            "normative",
            "illustration"
          ]
        },
        "role": {
          "enum": [
            "problem",
            "distinction",
            "central_mechanism",
            "principle",
            "conclusion",
            "support",
            "qualification"
          ]
        },
        "anchors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/anchor"
          }
        }
      }
    },
    "boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "description"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "anchor": {
          "$ref": "#/$defs/anchor"
        }
      }
    }
  }
}
