{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Project Constellation - fleet catalog schema",
  "type": "object",
  "required": [
    "schema_version",
    "catalog_id",
    "edition",
    "item_count",
    "counts",
    "items"
  ],
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "catalog_id": {
      "type": "string"
    },
    "edition": {
      "type": "string"
    },
    "item_count": {
      "type": "integer",
      "minimum": 1
    },
    "counts": {
      "type": "object"
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/vessel"
      }
    }
  },
  "$defs": {
    "vessel": {
      "type": "object",
      "required": [
        "id",
        "name_zh",
        "model_code",
        "classification",
        "description_zh",
        "dimensions",
        "media",
        "source",
        "verification_status",
        "image_evidence",
        "parent_vessel_ids",
        "needs_review"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^STF-[0-9]{3}$"
        },
        "name_zh": {
          "type": "string",
          "minLength": 1
        },
        "model_code": {
          "type": "string"
        },
        "classification": {
          "type": "string"
        },
        "description_zh": {
          "type": "string",
          "minLength": 1
        },
        "dimensions": {
          "type": "object",
          "properties": {
            "length_m": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0
            },
            "status": {
              "type": "string"
            }
          }
        },
        "media": {
          "type": "object",
          "required": [
            "hero",
            "thumbnail",
            "alt_zh",
            "image_available"
          ],
          "properties": {
            "hero": {
              "type": [
                "string",
                "null"
              ]
            },
            "thumbnail": {
              "type": [
                "string",
                "null"
              ]
            },
            "detail_crop": {
              "type": [
                "string",
                "null"
              ]
            },
            "alt_zh": {
              "type": "string"
            },
            "image_available": {
              "type": "boolean"
            }
          }
        },
        "source": {
          "type": "object",
          "required": [
            "type",
            "original_filename",
            "source_key"
          ],
          "properties": {
            "source_key": {
              "type": [
                "string",
                "null"
              ]
            },
            "original_filename": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "verification_status": {
          "enum": [
            "independent_artwork",
            "composite_board_panel",
            "illustrated_component",
            "conversation_only"
          ]
        },
        "image_evidence": {
          "enum": [
            "individual_board",
            "composite_panel",
            "illustrated_crop",
            "missing"
          ]
        },
        "parent_vessel_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^STF-[0-9]{3}$"
          }
        },
        "needs_review": {
          "type": "boolean"
        }
      }
    }
  }
}
