{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lebaneselegislation-com/json-schema/lebaneselegislation-com-article-detail-schema.json",
  "title": "ArticleDetail",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lebaneselegislation-com-openapi.json#/components/schemas/ArticleDetail",
  "type": "object",
  "required": [
    "law",
    "number",
    "text_ar",
    "url",
    "not_legal_advice"
  ],
  "properties": {
    "calculated_current": {
      "$ref": "#/$defs/CalculatedCurrent"
    },
    "law": {
      "$ref": "#/$defs/LawSummary"
    },
    "number": {
      "type": "string"
    },
    "note": {
      "type": "string"
    },
    "centre_error": {
      "type": "object",
      "properties": {
        "en": {
          "type": "string"
        },
        "ar": {
          "type": "string"
        }
      }
    },
    "text_ar": {
      "type": "string",
      "description": "The wording in force today, as the page prints it."
    },
    "text_fr": {
      "type": "string"
    },
    "centre_text_ar": {
      "type": "string",
      "description": "The Centre's wording, when an amendment replaced it."
    },
    "centre_text_fr": {
      "type": "string"
    },
    "in_force_from": {
      "$ref": "#/$defs/Date"
    },
    "versions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "major",
          "minor",
          "state",
          "text_source"
        ],
        "properties": {
          "major": {
            "type": "integer"
          },
          "minor": {
            "type": "integer"
          },
          "valid_from": {
            "$ref": "#/$defs/Date"
          },
          "valid_to": {
            "$ref": "#/$defs/Date"
          },
          "state": {
            "type": "string"
          },
          "text_ar": {
            "type": "string"
          },
          "text_source": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      }
    },
    "repealed": {
      "type": "boolean"
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "relation",
          "by",
          "found_by",
          "url"
        ],
        "properties": {
          "relation": {
            "type": "string"
          },
          "part": {
            "type": "string"
          },
          "by": {
            "$ref": "#/$defs/LawSummary"
          },
          "by_article": {
            "type": "string"
          },
          "effective_on": {
            "$ref": "#/$defs/Date"
          },
          "text_ar": {
            "type": "string"
          },
          "found_by": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "possibly_affected_by": {
      "type": "array",
      "description": "General repeals that may touch the article: leads to check, never findings.",
      "items": {
        "type": "object",
        "required": [
          "by",
          "by_article",
          "url"
        ],
        "properties": {
          "by": {
            "$ref": "#/$defs/LawSummary"
          },
          "by_article": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "rulings_count": {
      "type": "integer"
    },
    "rulings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "court",
          "url"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "court": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "decided_on": {
            "$ref": "#/$defs/Date"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "source_url": {
      "type": "string",
      "format": "uri"
    },
    "updated_at": {
      "$ref": "#/$defs/UpdatedAt"
    },
    "not_legal_advice": {
      "type": "string"
    }
  },
  "$defs": {
    "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"
    },
    "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"
        }
      }
    },
    "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."
    }
  }
}