{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Lomavis comparison data",
  "description": "Datierter Herstellervergleich. Quellenstatus und Unsicherheiten gehören zu jeder Einzelangabe. OMR-Nutzerurteile sind keine technischen Herstellerangaben.",
  "type": "object",
  "required": [
    "schemaVersion",
    "title",
    "publisher",
    "checkedAt",
    "scope",
    "selectionPolicy",
    "criteria",
    "categories",
    "providers",
    "availableRequirements",
    "availableChannels",
    "featureGroups",
    "availableFeatures",
    "automation"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "checkedAt": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T.*)?$"
        },
        {
          "type": "null"
        }
      ]
    },
    "publisher": {
      "$ref": "#/$defs/publisher"
    },
    "scope": {
      "type": "string"
    },
    "selectionPolicy": {
      "type": "object",
      "required": [
        "curated",
        "publisherHighlighted",
        "fixedReference",
        "ranking"
      ],
      "properties": {
        "curated": {
          "const": true
        },
        "publisherHighlighted": {
          "const": true
        },
        "fixedReference": {
          "const": "lomavis"
        },
        "ranking": {
          "const": false
        },
        "description": {
          "type": "string"
        }
      }
    },
    "criteria": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/criterion"
      }
    },
    "categories": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/namedItem"
      }
    },
    "availableRequirements": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/namedItem"
      }
    },
    "availableChannels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/namedItem"
      }
    },
    "featureGroups": {
      "type": "array",
      "minItems": 8,
      "items": {
        "$ref": "#/$defs/featureGroup"
      }
    },
    "availableFeatures": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/featureDetail"
      }
    },
    "providers": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/provider"
      }
    },
    "automation": {
      "type": "object",
      "required": [
        "active",
        "note"
      ],
      "properties": {
        "active": {
          "const": false
        },
        "note": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "publisher": {
      "type": "object",
      "required": [
        "name",
        "url"
      ],
      "properties": {
        "name": {
          "const": "Lomavis"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      }
    },
    "namedItem": {
      "type": "object",
      "required": [
        "id",
        "label"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "label": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "criterion": {
      "type": "object",
      "required": [
        "id",
        "label",
        "category"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "category": {
          "type": "string"
        }
      }
    },
    "featureDetail": {
      "type": "object",
      "required": [
        "id",
        "label",
        "help",
        "criterionId"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "help": {
          "type": "string"
        },
        "criterionId": {
          "type": "string"
        },
        "requirement": {
          "type": "string"
        }
      }
    },
    "featureGroup": {
      "type": "object",
      "required": [
        "id",
        "label",
        "help",
        "topics",
        "details"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "help": {
          "type": "string"
        },
        "requirement": {
          "type": "string"
        },
        "topics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "details": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "baseline": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "legacyDetails": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "fact": {
      "type": "object",
      "required": [
        "id",
        "category",
        "label",
        "value",
        "status",
        "sourceKind",
        "plan",
        "sourceUrl",
        "checkedAt",
        "restriction"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": "string",
          "description": "Textliche Einzelangabe; nicht in eine boolesche Ja/Nein-Antwort umdeuten. Numerische OMR-Werte stehen separat im reviews-Objekt."
        },
        "status": {
          "type": "string",
          "enum": [
            "confirmed",
            "limited",
            "addon",
            "unavailable",
            "unknown",
            "conflict",
            "estimate"
          ]
        },
        "sourceKind": {
          "type": "string",
          "enum": [
            "manufacturer",
            "user_reviews",
            "publisher_statement",
            "first_party_user_statement"
          ]
        },
        "plan": {
          "anyOf": [
            {
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "planIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Nur explizit bestätigte Tarife; eine leere Liste belegt keine Tarifinklusion."
        },
        "planCoverage": {
          "type": "string",
          "enum": [
            "confirmed",
            "unknown"
          ],
          "description": "Die technische Herstellerbeschreibung und die Zuordnung zu einem buchbaren Tarif werden getrennt beurteilt."
        },
        "sourceUrl": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            {
              "type": "null"
            }
          ]
        },
        "sourceReference": {
          "type": [
            "string",
            "null"
          ]
        },
        "secondarySourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "supportingSources": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "checkedAt": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T.*)?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "restriction": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence": {
          "type": [
            "string",
            "null"
          ]
        },
        "network": {
          "anyOf": [
            {
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "source": {
      "type": "object",
      "required": [
        "url",
        "title"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "title": {
          "type": "string"
        }
      }
    },
    "rating": {
      "type": "object",
      "required": [
        "score",
        "scale",
        "count",
        "sourceUrl"
      ],
      "properties": {
        "score": {
          "type": "number",
          "minimum": 0,
          "maximum": 5
        },
        "scale": {
          "const": 5
        },
        "count": {
          "type": "integer",
          "minimum": 0
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      }
    },
    "reviewDimension": {
      "type": "object",
      "required": [
        "id",
        "label",
        "score",
        "scale",
        "sourceUrl"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "score": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "scale": {
          "const": 100
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      }
    },
    "reviews": {
      "type": "object",
      "required": [
        "providerId",
        "source",
        "sourceUrl",
        "checkedAt",
        "overall",
        "dimensions",
        "summary",
        "rights",
        "notes"
      ],
      "properties": {
        "providerId": {
          "type": "string"
        },
        "source": {
          "const": "OMR Reviews"
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "checkedAt": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T.*)?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "overall": {
          "$ref": "#/$defs/rating"
        },
        "dimensions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/reviewDimension"
          }
        },
        "summary": {
          "type": "object",
          "required": [
            "strengths",
            "caveats",
            "basis"
          ],
          "properties": {
            "strengths": {
              "type": "string"
            },
            "caveats": {
              "type": "string"
            },
            "basis": {
              "type": "string"
            }
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rights": {
          "type": "object",
          "required": [
            "publicUseApproved",
            "state",
            "note"
          ],
          "properties": {
            "publicUseApproved": {
              "const": false
            },
            "state": {
              "const": "unconfirmed"
            },
            "note": {
              "type": "string"
            }
          }
        }
      }
    },
    "plan": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "monthlyEquivalent": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "annualTotal": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "includedUsers": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "includedProfiles": {
          "type": [
            "number",
            "string",
            "null"
          ]
        },
        "extraUserMonthly": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "extraProfileMonthly": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "priceStatus": {
          "type": "string"
        }
      }
    },
    "provider": {
      "type": "object",
      "required": [
        "id",
        "name",
        "website",
        "pricingUrl",
        "checkedAt",
        "sources",
        "facts",
        "pricing",
        "reviews",
        "openQuestions"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "website": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "pricingUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "checkedAt": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T.*)?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "sources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/source"
          }
        },
        "facts": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/fact"
          }
        },
        "pricing": {
          "type": "object",
          "required": [
            "plans"
          ],
          "properties": {
            "currency": {
              "type": [
                "string",
                "null"
              ]
            },
            "billing": {
              "type": "string"
            },
            "plans": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/plan"
              }
            }
          }
        },
        "reviews": {
          "$ref": "#/$defs/reviews"
        },
        "openQuestions": {
          "type": "array"
        }
      }
    }
  }
}
