{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thruput.se/agents/schemas/review/lines.schema.json",
  "title": "Lines",
  "description": "Line-level domain shapes of a [[Change]]: consecutive numbered lines, line ranges, removed lines with their text at the base, and file side",
  "oneOf": [
    {
      "$ref": "#/$defs/NumberedLines"
    },
    {
      "$ref": "#/$defs/RemovedLines"
    },
    {
      "$ref": "#/$defs/Side"
    }
  ],
  "$defs": {
    "NumberedLines": {
      "description": "Consecutive lines, each under its number, the first line of a file being 1",
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "$ref": "#/$defs/LineNumberName"
      },
      "additionalProperties": {
        "$ref": "#/$defs/LineText"
      }
    },
    "Side": {
      "description": "Which numbering the lines use: head for the file at the head commit, base for the file at the base",
      "enum": [
        "head",
        "base"
      ]
    },
    "LineNumber": {
      "description": "A line of a file, by its 1-based number",
      "type": "integer",
      "minimum": 1
    },
    "LineNumberName": {
      "description": "A line number as the name of a property: a whole number from 1",
      "type": "string",
      "pattern": "^[1-9][0-9]*$"
    },
    "LineText": {
      "description": "One line of a file, without its line break",
      "type": "string"
    },
    "LineRange": {
      "description": "Consecutive lines of one file, by their 1-based numbers, both ends included",
      "type": "object",
      "required": [
        "start",
        "end"
      ],
      "properties": {
        "start": {
          "$ref": "#/$defs/LineNumber"
        },
        "end": {
          "$ref": "#/$defs/LineNumber"
        }
      }
    },
    "RemovedContent": {
      "description": "The text of removed lines as they stood at the base, one line of text per line removed",
      "type": "string"
    },
    "RemovedLines": {
      "description": "Consecutive lines the [[Change]] removes, with their text",
      "$ref": "#/$defs/LineRange",
      "required": [
        "content"
      ],
      "properties": {
        "content": {
          "$ref": "#/$defs/RemovedContent"
        }
      }
    }
  },
  "examples": [
    {
      "21": "npx --yes @sourcemeta/jsonschema@17.0.0 metaschema \"$PROJECT_ROOT/schemas\""
    }
  ]
}
