{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.smarthomeuk.co.uk/wp-content/uploads/shuk-compatibility-commons/2026-09-06/schemas/compatibility-commons.schema.json",
  "title": "SHUK Compatibility Commons catalog",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema_version",
    "release",
    "title",
    "description",
    "licence",
    "editorial_boundary",
    "statistics",
    "datasets",
    "sources"
  ],
  "properties": {
    "$schema": {
      "const": "https://www.smarthomeuk.co.uk/wp-content/uploads/shuk-compatibility-commons/2026-09-06/schemas/compatibility-commons.schema.json"
    },
    "schema_version": {
      "const": "1.1"
    },
    "release": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "version",
        "date",
        "status",
        "publisher",
        "region",
        "candidate_publication_base_path",
        "candidate_publication_base_url",
        "previous_release"
      ],
      "properties": {
        "id": {
          "const": "76-shuk-compatibility-commons-v1.1.0"
        },
        "version": {
          "const": "1.1.0"
        },
        "date": {
          "type": "string",
          "format": "date"
        },
        "status": {
          "const": "VERSIONED_RELEASE"
        },
        "publisher": {
          "const": "SHUK"
        },
        "region": {
          "const": "United Kingdom"
        },
        "candidate_publication_base_path": {
          "const": "/wp-content/uploads/shuk-compatibility-commons/2026-09-06/"
        },
        "candidate_publication_base_url": {
          "const": "https://www.smarthomeuk.co.uk/wp-content/uploads/shuk-compatibility-commons/2026-09-06/"
        },
        "previous_release": {
          "type": "object",
          "required": [
            "version",
            "date",
            "url",
            "policy"
          ],
          "additionalProperties": false,
          "properties": {
            "version": {
              "const": "1.0.0"
            },
            "date": {
              "const": "2026-08-30"
            },
            "url": {
              "const": "https://www.smarthomeuk.co.uk/wp-content/uploads/shuk-compatibility-commons/2026-08-30/index.html"
            },
            "policy": {
              "type": "string"
            }
          }
        }
      }
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "licence": {
      "type": "object"
    },
    "editorial_boundary": {
      "type": "object"
    },
    "statistics": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "dataset_count",
        "compatibility_row_count",
        "source_record_count",
        "rows_with_explicit_conflict_or_limit",
        "shopping_evidence_row_count",
        "total_row_count"
      ],
      "properties": {
        "dataset_count": {
          "type": "integer",
          "minimum": 1
        },
        "compatibility_row_count": {
          "type": "integer",
          "minimum": 1
        },
        "source_record_count": {
          "type": "integer",
          "minimum": 1
        },
        "rows_with_explicit_conflict_or_limit": {
          "type": "integer",
          "minimum": 1
        },
        "shopping_evidence_row_count": {
          "type": "integer",
          "minimum": 1
        },
        "total_row_count": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "datasets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "title",
          "description",
          "cluster",
          "version",
          "release_date",
          "source_snapshot",
          "csv_path",
          "primary_key",
          "checked_date_field",
          "source_fields",
          "conflict_field",
          "row_count",
          "fields",
          "rows"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "cluster": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "const": "1.1.0"
          },
          "release_date": {
            "type": "string",
            "format": "date"
          },
          "source_snapshot": {
            "type": "string",
            "minLength": 1
          },
          "csv_path": {
            "type": "string",
            "pattern": "^data/v1/"
          },
          "primary_key": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "checked_date_field": {
            "type": "string",
            "minLength": 1
          },
          "source_fields": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "conflict_field": {
            "type": "string",
            "minLength": 1
          },
          "row_count": {
            "type": "integer",
            "minimum": 1
          },
          "fields": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "name",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "const": "string"
                }
              }
            }
          },
          "rows": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        }
      }
    }
  }
}
