{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sashite.dev/schemas/lcn/1.0.0/schema.json",
  "title": "Location Condition Notation (LCN) v1.0.0",
  "description": "JSON Schema for location conditions in abstract board games using LCN format with CELL coordinates and state values.",
  "type": "object",

  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    }
  },

  "patternProperties": {
    "^[a-z]+(?:[1-9]\\d*[A-Z]+[a-z]+)*(?:[1-9]\\d*(?:[A-Z]+)?)?$": {
      "description": "Location state: 'empty', 'enemy', or specific QPI piece identifier",
      "type": "string",
      "pattern": "^(?:empty|enemy|([A-Z]:[-+]?[A-Z]'?|[a-z]:[-+]?[a-z]'?))$"
    }
  },

  "additionalProperties": false,

  "examples": [
    {
      "description": "Empty conditions - no constraints",
      "value": {}
    },
    {
      "description": "Single empty location requirement",
      "value": {
        "e4": "empty"
      }
    },
    {
      "description": "Single enemy piece requirement",
      "value": {
        "f5": "enemy"
      }
    },
    {
      "description": "Specific piece requirement",
      "value": {
        "h1": "C:+R"
      }
    },
    {
      "description": "Path clearance conditions",
      "value": {
        "b2": "empty",
        "c3": "empty",
        "d4": "empty"
      }
    },
    {
      "description": "Mixed condition types",
      "value": {
        "f1": "empty",
        "g1": "empty",
        "h1": "C:+R"
      }
    },
    {
      "description": "Capture condition",
      "value": {
        "e5": "enemy"
      }
    },
    {
      "description": "En passant conditions",
      "value": {
        "f6": "empty",
        "f5": "c:-p"
      }
    },
    {
      "description": "File restriction (Shōgi pawn drop)",
      "value": {
        "e1": "S:P",
        "e2": "S:P",
        "e3": "S:P",
        "e5": "S:P",
        "e6": "S:P",
        "e7": "S:P",
        "e8": "S:P",
        "e9": "S:P"
      }
    },
    {
      "description": "Complex castling conditions",
      "value": {
        "f1": "empty",
        "g1": "empty",
        "h1": "C:+R"
      }
    },
    {
      "description": "Multi-dimensional coordinates",
      "value": {
        "b2B": "empty",
        "c3C": "empty",
        "d4D": "empty"
      }
    },
    {
      "description": "Extended CELL coordinates",
      "value": {
        "aa1AA": "empty",
        "bb2BB": "enemy"
      }
    },
    {
      "description": "Piece state conditions",
      "value": {
        "e1": "C:+K",
        "h1": "C:+R"
      }
    },
    {
      "description": "Cross-style pieces",
      "value": {
        "a1": "C:R",
        "b2": "x:c"
      }
    },
    {
      "description": "Derived piece notation",
      "value": {
        "e4": "S:P'",
        "f5": "c:p'"
      }
    }
  ],

  "counterExamples": [
    {
      "description": "Invalid CELL format - uppercase first",
      "value": {
        "E4": "empty"
      }
    },
    {
      "description": "Invalid CELL format - number first",
      "value": {
        "4e": "empty"
      }
    },
    {
      "description": "Invalid state value - unknown keyword",
      "value": {
        "e4": "occupied"
      }
    },
    {
      "description": "Invalid QPI format - missing colon",
      "value": {
        "e4": "CHESSP"
      }
    },
    {
      "description": "Invalid QPI format - multi-character style",
      "value": {
        "e4": "CHESS:P"
      }
    },
    {
      "description": "Invalid QPI format - mixed case style",
      "value": {
        "e4": "Chess:P"
      }
    },
    {
      "description": "Invalid QPI format - case mismatch",
      "value": {
        "e4": "C:p"
      }
    },
    {
      "description": "Invalid CELL format - zero in coordinate",
      "value": {
        "e0": "empty"
      }
    },
    {
      "description": "Invalid CELL format - invalid character",
      "value": {
        "e-4": "empty"
      }
    },
    {
      "description": "Invalid state value - empty string",
      "value": {
        "e4": ""
      }
    },
    {
      "description": "Invalid state value - numeric",
      "value": {
        "e4": 1
      }
    },
    {
      "description": "Invalid state value - boolean",
      "value": {
        "e4": true
      }
    },
    {
      "description": "Invalid CELL format - special characters",
      "value": {
        "e4@": "empty"
      }
    },
    {
      "description": "Invalid QPI format - double colon",
      "value": {
        "e4": "C::P"
      }
    }
  ]
}
