{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lebaneselegislation-com/json-schema/lebaneselegislation-com-search-result-schema.json",
  "title": "SearchResult",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lebaneselegislation-com-openapi.json#/components/schemas/SearchResult",
  "type": "object",
  "required": [
    "q",
    "law_count",
    "article_count",
    "ruling_count",
    "gazette_count"
  ],
  "properties": {
    "q": {
      "type": "string"
    },
    "laws": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LawSummary"
      }
    },
    "law_count": {
      "type": "integer"
    },
    "articles": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ArticleHit"
      }
    },
    "article_count": {
      "type": "integer"
    },
    "rulings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RulingHit"
      }
    },
    "ruling_count": {
      "type": "integer"
    },
    "gazette": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GazetteHit"
      }
    },
    "gazette_count": {
      "type": "integer"
    },
    "searched_instead": {
      "type": "string"
    },
    "searched_instead_kind": {
      "type": "string",
      "enum": [
        "translated",
        "adjusted"
      ]
    },
    "related": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Passage"
      }
    },
    "semantic": {
      "type": "string",
      "enum": [
        "ok",
        "unavailable"
      ]
    },
    "selection": {
      "type": "string",
      "enum": [
        "ok",
        "unavailable"
      ]
    },
    "next_cursor": {
      "type": "string",
      "description": "Pass it as cursor for the next page of every kind that has more; absent on the last page. Each kind is ranked and its next page starts after its last row."
    }
  },
  "$defs": {
    "ArticleHit": {
      "type": "object",
      "required": [
        "law",
        "article_number",
        "snippet",
        "url"
      ],
      "properties": {
        "calculated_current": {
          "$ref": "#/$defs/CalculatedCurrent"
        },
        "law": {
          "$ref": "#/$defs/LawSummary"
        },
        "article_number": {
          "type": "string"
        },
        "snippet": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "matched_calculated_current": {
          "type": "boolean"
        },
        "cited": {
          "type": "boolean",
          "description": "The query cites this article, so it comes first."
        }
      }
    },
    "CalculatedCurrent": {
      "type": "object",
      "description": "A monetary amount calculated under decree 13909/2024 (multiplier 50, effective 2024-09-19). Not published wording: cite authority.url.",
      "additionalProperties": true
    },
    "Date": {
      "type": "string",
      "format": "date"
    },
    "GazetteHit": {
      "type": "object",
      "required": [
        "id",
        "url"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "number": {
          "type": "string"
        },
        "published_on": {
          "$ref": "#/$defs/Date"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "updated_at": {
          "$ref": "#/$defs/UpdatedAt"
        }
      }
    },
    "LawSummary": {
      "type": "object",
      "description": "A text's identity, without its text.",
      "required": [
        "id",
        "kind",
        "title",
        "status",
        "article_count",
        "url"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "kind": {
          "type": "string",
          "description": "In Arabic, as the Centre names it."
        },
        "kind_en": {
          "type": "string"
        },
        "number": {
          "type": "string"
        },
        "issued_on": {
          "$ref": "#/$defs/Date"
        },
        "title": {
          "type": "string",
          "description": "The official Arabic title."
        },
        "title_en": {
          "type": "string",
          "description": "Unofficial English title, written by a model from the Arabic title."
        },
        "status": {
          "type": "string",
          "enum": [
            "in_force",
            "repealed"
          ]
        },
        "article_count": {
          "type": "integer"
        },
        "code": {
          "type": "string",
          "description": "The curated code's short name, e.g. \"Code of Obligations and Contracts\"."
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "updated_at": {
          "$ref": "#/$defs/UpdatedAt"
        }
      }
    },
    "Passage": {
      "type": "object",
      "required": [
        "id",
        "title",
        "text",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "lang": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "unofficial": {
          "type": "boolean"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "RulingHit": {
      "type": "object",
      "required": [
        "id",
        "title",
        "url"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "title": {
          "type": "string"
        },
        "court": {
          "type": "string"
        },
        "decided_on": {
          "$ref": "#/$defs/Date"
        },
        "snippet": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "pdf_url": {
          "type": "string",
          "format": "uri",
          "description": "The judgment's scan on the Lebanese University's site."
        },
        "judgment_page": {
          "type": "integer",
          "description": "Only the machine reading matched: the page the snippet is from."
        },
        "updated_at": {
          "$ref": "#/$defs/UpdatedAt"
        }
      }
    },
    "UpdatedAt": {
      "type": "string",
      "format": "date",
      "description": "The day the record's page last changed on the site (page_state): an amendment in force, a ruling's reading, a correction. Never the text's own date. Absent when not known."
    }
  }
}