{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.wanlinfire.com/verified-product-comparison.schema.json",
  "title": "Evidence-Bounded Product Comparison",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "comparison_id",
    "intended_use",
    "products",
    "decision_status"
  ],
  "properties": {
    "comparison_id": {
      "type": "string"
    },
    "market": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
    },
    "intended_use": {
      "type": "string",
      "minLength": 10
    },
    "project_conditions": {
      "type": "object"
    },
    "products": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "passport_id",
          "canonical_url",
          "fields"
        ],
        "properties": {
          "passport_id": {
            "type": "string",
            "format": "uri"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "exact_model": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "field_id",
                "status"
              ],
              "properties": {
                "field_id": {
                  "enum": [
                    "model",
                    "detection_principle",
                    "sensor_element",
                    "alarm_threshold",
                    "power_supply",
                    "battery_life",
                    "interconnect_protocol",
                    "coverage_area",
                    "sound_output",
                    "ip_rating",
                    "operating_temp",
                    "humidity_range",
                    "housing_material",
                    "dimensions_weight",
                    "certifications",
                    "additional_features"
                  ]
                },
                "source_value": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": [
                          "string",
                          "number"
                        ]
                      }
                    },
                    {
                      "type": "object"
                    }
                  ]
                },
                "source_unit": {
                  "type": "string"
                },
                "normalized_value": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": [
                          "string",
                          "number"
                        ]
                      }
                    },
                    {
                      "type": "object"
                    }
                  ]
                },
                "normalized_unit": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "unknown",
                    "publisher-declared",
                    "document-verified",
                    "project-confirmed",
                    "authority-confirmed",
                    "not-applicable",
                    "superseded"
                  ]
                },
                "evidence_url": {
                  "type": "string",
                  "format": "uri"
                },
                "document_identifier": {
                  "type": "string"
                },
                "limitations": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "decision_status": {
      "enum": [
        "information-only",
        "document-review-required",
        "engineering-review-required",
        "project-confirmed",
        "authority-confirmed",
        "no-valid-comparison"
      ]
    },
    "decision_rationale": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "reviewed_by": {
      "type": "string"
    },
    "reviewed_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
