{
 "type": "object",
 "properties": {
  "schemaVersion": {
   "const": 1
  },
  "generated": {
   "type": "string",
   "minLength": 1,
   "format": "date-time"
  },
  "release": {
   "type": "string"
  },
  "publisher": {
   "const": "DroneLedger"
  },
  "site": {
   "type": "string",
   "minLength": 1,
   "format": "uri"
  },
  "license": {
   "type": "object",
   "properties": {
    "name": {
     "type": "string",
     "minLength": 1
    },
    "url": {
     "type": "string",
     "minLength": 1,
     "format": "uri"
    },
    "attribution": {
     "type": "string",
     "minLength": 1
    },
    "excludes": {
     "type": "string",
     "minLength": 1
    }
   },
   "required": [
    "name",
    "url",
    "attribution",
    "excludes"
   ],
   "additionalProperties": false
  },
  "note": {
   "type": "string",
   "minLength": 1
  },
  "profiles": {
   "type": "array",
   "items": {
    "$ref": "#/$defs/profile"
   }
  }
 },
 "required": [
  "schemaVersion",
  "generated",
  "release",
  "publisher",
  "site",
  "license",
  "note",
  "profiles"
 ],
 "additionalProperties": false,
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://droneincidents.com/api/v1/schemas/drone-profiles.schema.json",
 "title": "DroneLedger research collection v1",
 "description": "Release-bound public research snapshot. generated is the build clock; edition is the research edition. JSON Schema checks structure, not truth, source independence or cross-field scientific consistency. No operational positions are exported.",
 "$defs": {
  "localized": {
   "type": "object",
   "properties": {
    "en": {
     "type": "string",
     "minLength": 1
    },
    "uk": {
     "type": "string",
     "minLength": 1
    },
    "ru": {
     "type": "string",
     "minLength": 1
    },
    "ar": {
     "type": "string",
     "minLength": 1
    },
    "fa": {
     "type": "string",
     "minLength": 1
    }
   },
   "required": [
    "en",
    "uk",
    "ru",
    "ar",
    "fa"
   ],
   "additionalProperties": false,
   "description": "All five public translations; no fallback translation is inferred."
  },
  "source": {
   "type": "object",
   "properties": {
    "id": {
     "type": "string",
     "minLength": 1,
     "pattern": "^[a-z0-9-]+$"
    },
    "url": {
     "type": "string",
     "minLength": 1,
     "format": "uri"
    },
    "title": {
     "type": "string",
     "minLength": 1
    },
    "publisher": {
     "type": "string",
     "minLength": 1
    },
    "published": {
     "anyOf": [
      {
       "type": "string",
       "minLength": 1,
       "format": "date",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      {
       "type": "null"
      }
     ]
    },
    "accessed": {
     "type": "string",
     "minLength": 1,
     "format": "date",
     "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "kind": {
     "enum": [
      "analysis",
      "official",
      "manufacturer",
      "reporting"
     ]
    },
    "accessMethod": {
     "enum": [
      "page",
      "search-index"
     ]
    }
   },
   "required": [
    "id",
    "url",
    "title",
    "publisher",
    "published",
    "accessed",
    "kind"
   ],
   "additionalProperties": false,
   "description": "A cited source. Omitted accessMethod means page; search-index is not a page read. Publication day is not an exact clock."
  },
  "observation": {
   "type": "object",
   "properties": {
    "key": {
     "enum": [
      "rangeKm",
      "operatingRangeKm",
      "operatingRadiusKm",
      "speedKmh",
      "speedKnots",
      "massKg",
      "payloadKg",
      "warheadKg",
      "lengthM",
      "wingspanM",
      "widthM",
      "beamM",
      "enduranceMin",
      "enduranceH",
      "linkKm",
      "rangeNm",
      "surfaceRangeKm"
     ]
    },
    "min": {
     "type": [
      "number",
      "null"
     ],
     "exclusiveMinimum": 0
    },
    "max": {
     "type": [
      "number",
      "null"
     ],
     "exclusiveMinimum": 0
    },
    "minExclusive": {
     "type": "boolean"
    },
    "maxExclusive": {
     "type": "boolean"
    },
    "unit": {
     "enum": [
      "km",
      "km/h",
      "kt",
      "kg",
      "m",
      "min",
      "h",
      "nm"
     ]
    },
    "sourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9-]+$"
     },
     "minItems": 1,
     "uniqueItems": true
    },
    "year": {
     "type": [
      "integer",
      "null"
     ],
     "minimum": 1900
    },
    "variant": {
     "type": "string",
     "minLength": 1
    },
    "qualifier": {
     "enum": [
      "approximate",
      "reported",
      "manufacturer",
      "upper-bound",
      "lower-bound"
     ]
    },
    "decimalPlaces": {
     "type": "integer",
     "minimum": 0,
     "maximum": 6
    }
   },
   "required": [
    "key",
    "min",
    "max",
    "unit",
    "sourceIds",
    "year",
    "variant",
    "qualifier"
   ],
   "additionalProperties": false,
   "description": "One source-bound observation for a named configuration. Null bounds are unknown, never zero. Exclusive flags default to false. Values across variants must not be combined. Source IDs resolve within this profile.",
   "allOf": [
    {
     "anyOf": [
      {
       "properties": {
        "min": {
         "type": "number"
        }
       }
      },
      {
       "properties": {
        "max": {
         "type": "number"
        }
       }
      }
     ]
    },
    {
     "if": {
      "required": [
       "minExclusive"
      ],
      "properties": {
       "minExclusive": {
        "const": true
       }
      }
     },
     "then": {
      "properties": {
       "min": {
        "type": "number"
       }
      }
     }
    },
    {
     "if": {
      "required": [
       "maxExclusive"
      ],
      "properties": {
       "maxExclusive": {
        "const": true
       }
      }
     },
     "then": {
      "properties": {
       "max": {
        "type": "number"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "rangeKm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "operatingRangeKm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "operatingRadiusKm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "speedKmh"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km/h"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "speedKnots"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "kt"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "massKg"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "kg"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "payloadKg"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "kg"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "warheadKg"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "kg"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "lengthM"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "m"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "wingspanM"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "m"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "widthM"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "m"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "beamM"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "m"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "enduranceMin"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "min"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "enduranceH"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "h"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "linkKm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "rangeNm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "nm"
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "key": {
        "const": "surfaceRangeKm"
       }
      }
     },
     "then": {
      "properties": {
       "unit": {
        "const": "km"
       }
      }
     }
    }
   ]
  },
  "sourcedText": {
   "type": "object",
   "properties": {
    "text": {
     "$ref": "#/$defs/localized"
    },
    "sourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9-]+$"
     },
     "minItems": 1,
     "uniqueItems": true
    }
   },
   "required": [
    "text",
    "sourceIds"
   ],
   "additionalProperties": false
  },
  "relation": {
   "type": "object",
   "properties": {
    "name": {
     "type": "string",
     "minLength": 1
    },
    "kind": {
     "enum": [
      "variant",
      "related",
      "jet-analogue",
      "analogue",
      "local-production"
     ]
    },
    "typeId": {
     "type": "string",
     "minLength": 1,
     "pattern": "^[a-z0-9-]+$"
    },
    "sourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9-]+$"
     },
     "minItems": 1,
     "uniqueItems": true
    }
   },
   "required": [
    "name",
    "kind",
    "sourceIds"
   ],
   "additionalProperties": false
  },
  "cost": {
   "type": "object",
   "properties": {
    "low": {
     "type": [
      "number",
      "null"
     ],
     "exclusiveMinimum": 0
    },
    "high": {
     "type": [
      "number",
      "null"
     ],
     "exclusiveMinimum": 0
    },
    "currency": {
     "enum": [
      "USD",
      "EUR"
     ]
    },
    "year": {
     "type": "integer",
     "minimum": 1900
    },
    "sourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9-]+$"
     },
     "minItems": 1,
     "uniqueItems": true
    },
    "context": {
     "$ref": "#/$defs/localized"
    }
   },
   "required": [
    "low",
    "high",
    "currency",
    "year",
    "sourceIds",
    "context"
   ],
   "additionalProperties": false,
   "description": "Dated public estimate with its own context, not an audited or universal price.",
   "anyOf": [
    {
     "properties": {
      "low": {
       "type": "number"
      }
     }
    },
    {
     "properties": {
      "high": {
       "type": "number"
      }
     }
    }
   ]
  },
  "research": {
   "type": "object",
   "properties": {
    "origin": {
     "type": [
      "string",
      "null"
     ],
     "pattern": "^[A-Z]{2}$"
    },
    "originSourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1
     },
     "uniqueItems": true
    },
    "role": {
     "enum": [
      "one-way",
      "loitering",
      "reusable",
      "civil",
      "isr",
      "maritime"
     ]
    },
    "sources": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/source"
     },
     "minItems": 1
    },
    "summary": {
     "$ref": "#/$defs/localized"
    },
    "summarySourceIds": {
     "type": "array",
     "items": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9-]+$"
     },
     "minItems": 1,
     "uniqueItems": true
    },
    "observations": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/observation"
     }
    },
    "recognition": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/sourcedText"
     }
    },
    "relations": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/relation"
     }
    },
    "schemaVersion": {
     "const": 1
    },
    "edition": {
     "type": "string",
     "minLength": 1,
     "format": "date",
     "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "costs": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/cost"
     }
    },
    "counterLayers": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/sourcedText"
     }
    },
    "names": {
     "$ref": "#/$defs/localized"
    },
    "illustration": {
     "type": "object",
     "properties": {
      "top": {
       "enum": [
        "delta-prop",
        "delta-jet",
        "fixed-wing",
        "cruciform",
        "male-v",
        "male-twin",
        "twinboom",
        "quad-folding",
        "usv",
        "tube",
        "flying-wing",
        "canard-jet",
        "canard",
        "canard-delta",
        "hexacopter",
        "uuv"
       ]
      },
      "side": {
       "enum": [
        "delta-prop",
        "delta-jet",
        "fixed-wing",
        "cruciform",
        "male-v",
        "male-twin",
        "twinboom",
        "quad-folding",
        "usv",
        "tube",
        "flying-wing",
        "canard-jet",
        "canard",
        "canard-delta",
        "hexacopter",
        "uuv"
       ]
      },
      "contour": {
       "const": "schematic"
      },
      "sourceIds": {
       "type": "array",
       "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "^[a-z0-9-]+$"
       },
       "minItems": 1,
       "uniqueItems": true
      }
     },
     "required": [
      "top",
      "side",
      "contour",
      "sourceIds"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "origin",
    "originSourceIds",
    "role",
    "sources",
    "summary",
    "summarySourceIds",
    "observations",
    "recognition",
    "relations",
    "schemaVersion",
    "edition"
   ],
   "additionalProperties": false
  },
  "typeEvidence": {
   "type": "object",
   "properties": {
    "type": {
     "type": [
      "string",
      "null"
     ]
    },
    "category": {
     "type": "string",
     "minLength": 1
    },
    "basis": {
     "enum": [
      "source",
      "family",
      "assessment"
     ]
    },
    "level": {
     "type": [
      "string",
      "null"
     ],
     "enum": [
      null,
      "likely",
      "very_likely",
      "almost_certain"
     ]
    },
    "scope": {
     "enum": [
      "model",
      "family"
     ]
    },
    "reportedType": {
     "type": [
      "string",
      "null"
     ]
    }
   },
   "required": [
    "type",
    "category",
    "basis",
    "level",
    "scope",
    "reportedType"
   ],
   "additionalProperties": false,
   "description": "A source-indexed type or positive editorial assessment; not a verified identification."
  },
  "link": {
   "type": "object",
   "properties": {
    "id": {
     "type": "string",
     "minLength": 1
    },
    "url": {
     "type": "string",
     "minLength": 1,
     "format": "uri"
    },
    "scope": {
     "enum": [
      "model",
      "family"
     ]
    },
    "eventDate": {
     "anyOf": [
      {
       "type": "string",
       "minLength": 1,
       "format": "date",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      {
       "type": "null"
      }
     ]
    },
    "dateKind": {
     "enum": [
      "event",
      "statement",
      "unknown"
     ]
    },
    "windowStart": {
     "anyOf": [
      {
       "type": "string",
       "minLength": 1,
       "format": "date",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      {
       "type": "null"
      }
     ]
    },
    "windowEnd": {
     "anyOf": [
      {
       "type": "string",
       "minLength": 1,
       "format": "date",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      {
       "type": "null"
      }
     ]
    },
    "review": {
     "enum": [
      "editor",
      "auto"
     ]
    },
    "typeEvidence": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/typeEvidence"
     },
     "minItems": 1
    }
   },
   "required": [
    "id",
    "url",
    "scope",
    "eventDate",
    "dateKind",
    "windowStart",
    "windowEnd",
    "review",
    "typeEvidence"
   ],
   "additionalProperties": false
  },
  "scope": {
   "type": "object",
   "properties": {
    "dossiers": {
     "type": "integer",
     "minimum": 0
    },
    "lastEventDate": {
     "anyOf": [
      {
       "type": "string",
       "minLength": 1,
       "format": "date",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      {
       "type": "null"
      }
     ]
    }
   },
   "required": [
    "dossiers",
    "lastEventDate"
   ],
   "additionalProperties": false,
   "description": "Deduplicated dossiers, not aircraft. lastEventDate uses only event dates without reporting windows; null is unknown or no dated link, not absence."
  },
  "profile": {
   "type": "object",
   "properties": {
    "id": {
     "type": "string",
     "minLength": 1,
     "pattern": "^[a-z0-9-]+$"
    },
    "name": {
     "type": "string",
     "minLength": 1
    },
    "category": {
     "type": "string",
     "minLength": 1
    },
    "url": {
     "type": "string",
     "minLength": 1,
     "format": "uri"
    },
    "research": {
     "$ref": "#/$defs/research"
    },
    "archive": {
     "type": "object",
     "properties": {
      "totalDossiers": {
       "type": "integer",
       "minimum": 0
      },
      "scopes": {
       "type": "object",
       "properties": {
        "model": {
         "$ref": "#/$defs/scope"
        },
        "family": {
         "$ref": "#/$defs/scope"
        }
       },
       "required": [
        "model",
        "family"
       ],
       "additionalProperties": false
      },
      "links": {
       "type": "array",
       "items": {
        "$ref": "#/$defs/link"
       }
      }
     },
     "required": [
      "totalDossiers",
      "scopes",
      "links"
     ],
     "additionalProperties": false,
     "description": "Model and family scopes are disjoint; model takes precedence for a dossier linked at both scopes."
    }
   },
   "required": [
    "id",
    "name",
    "category",
    "url",
    "research",
    "archive"
   ],
   "additionalProperties": false
  }
 }
}
