{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.edikka.com/docbd/data/landing-page-audit-grid-v1.schema.json",
  "title": "Edikka Landing Page Audit Grid v1 — data schema",
  "description": "Bilingual data contract for the French and English editions of the Edikka Landing Page Audit Grid v1.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "title",
    "description",
    "version",
    "documentation_version",
    "published_at",
    "last_reviewed_at",
    "publisher",
    "canonical_url",
    "license",
    "citation",
    "canonical_names",
    "governance",
    "method",
    "changelog",
    "axes"
  ],
  "properties": {
    "$schema": {
      "const": "https://www.edikka.com/docbd/data/landing-page-audit-grid-v1.schema.json"
    },
    "title": {
      "$ref": "#/$defs/nonEmptyString"
    },
    "description": {
      "$ref": "#/$defs/nonEmptyString"
    },
    "version": {
      "type": "string",
      "pattern": "^1\\.0(?:\\.0)?$"
    },
    "documentation_version": {
      "type": "string",
      "pattern": "^1\\.0(?:\\.[0-9]+)?$"
    },
    "published_at": {
      "$ref": "#/$defs/isoDate"
    },
    "last_reviewed_at": {
      "$ref": "#/$defs/isoDate"
    },
    "publisher": {
      "$ref": "#/$defs/nonEmptyString"
    },
    "canonical_url": {
      "$ref": "#/$defs/httpsUri"
    },
    "license": {
      "const": "https://creativecommons.org/licenses/by/4.0/"
    },
    "citation": {
      "$ref": "#/$defs/nonEmptyString"
    },
    "canonical_names": {
      "type": "object",
      "additionalProperties": false,
      "required": ["method", "instrument", "anatomy"],
      "properties": {
        "method": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "instrument": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "anatomy": {
          "$ref": "#/$defs/nonEmptyString"
        }
      }
    },
    "governance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "score_validity",
        "review_triggers",
        "maximum_review_interval_days"
      ],
      "properties": {
        "score_validity": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "review_triggers": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/nonEmptyString"
          }
        },
        "maximum_review_interval_days": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "method": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scale",
        "formula",
        "maximum",
        "attainable_totals",
        "inter_rater_protocol",
        "interpretation",
        "warning"
      ],
      "properties": {
        "scale": {
          "const": [0, 1, 2]
        },
        "formula": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "maximum": {
          "const": 100
        },
        "attainable_totals": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "inter_rater_protocol": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "interpretation": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["min", "max", "label"],
            "properties": {
              "min": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "max": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "label": {
                "$ref": "#/$defs/nonEmptyString"
              }
            }
          }
        },
        "warning": {
          "$ref": "#/$defs/nonEmptyString"
        }
      }
    },
    "changelog": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["date", "version", "change"],
        "properties": {
          "date": {
            "$ref": "#/$defs/isoDate"
          },
          "version": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?$"
          },
          "change": {
            "$ref": "#/$defs/nonEmptyString"
          }
        }
      }
    },
    "axes": {
      "type": "array",
      "minItems": 8,
      "maxItems": 8,
      "items": {
        "$ref": "#/$defs/axis"
      },
      "allOf": [
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP01" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP02" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP03" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP04" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP05" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP06" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP07" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        },
        {
          "contains": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "const": "LP08" }
            }
          },
          "minContains": 1,
          "maxContains": 1
        }
      ]
    }
  },
  "$defs": {
    "nonEmptyString": {
      "type": "string",
      "minLength": 1
    },
    "isoDate": {
      "type": "string",
      "format": "date",
      "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])$"
    },
    "httpsUri": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "axis": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "weight",
        "score_0",
        "score_1",
        "score_2",
        "evidence"
      ],
      "properties": {
        "id": {
          "enum": ["LP01", "LP02", "LP03", "LP04", "LP05", "LP06", "LP07", "LP08"]
        },
        "name": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "weight": {
          "type": "number",
          "exclusiveMinimum": 0,
          "maximum": 100
        },
        "score_0": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "score_1": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "score_2": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "evidence": {
          "$ref": "#/$defs/nonEmptyString"
        }
      }
    }
  }
}
