{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://headphonesbase.com/data/v1/model.schema.json",
  "title": "HeadphonesBase model record v1",
  "type": "object",
  "required": [
    "id",
    "slug",
    "fields",
    "officialProductUrl",
    "sourceReviewedAt",
    "useCases",
    "conflicts",
    "image",
    "predecessor",
    "successor"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^model:"
    },
    "slug": {
      "type": "string"
    },
    "officialProductUrl": {
      "type": "string",
      "format": "uri"
    },
    "sourceReviewedAt": {
      "type": "string",
      "format": "date"
    },
    "fields": {
      "type": "object",
      "required": [
        "manufacturer",
        "brand",
        "model",
        "variant",
        "generation",
        "releaseDate",
        "status",
        "form",
        "design",
        "connection",
        "wireless",
        "anc",
        "driverTechnology",
        "driver",
        "impedance",
        "sensitivity",
        "frequency",
        "weight",
        "bluetoothVersion",
        "codecs",
        "microphone",
        "battery",
        "charging",
        "connectors",
        "cable",
        "impedanceOhms"
      ],
      "additionalProperties": {
        "$ref": "#/$defs/field"
      }
    }
  },
  "$defs": {
    "field": {
      "type": "object",
      "required": [
        "status",
        "value",
        "sources"
      ],
      "properties": {
        "status": {
          "enum": [
            "documented",
            "unknown",
            "not-published",
            "not-applicable",
            "conflicting"
          ]
        },
        "value": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "unit": {
          "type": "string"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "enum": [
                  "unknown",
                  "not-published",
                  "not-applicable",
                  "conflicting"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "value": {
                "type": "null"
              }
            }
          }
        }
      ]
    }
  }
}
