{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sedirk.cn/lenses/data/upload-schema.json",
  "title": "SEDIRK Lens Upload 1.0",
  "description": "UTF-8 JSON <=1 MiB;1–100records;data-only plaintext. Semantic and rate checks also run on server. Submitted records remain private pending review. No automatic votes or bulk submissions.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "lenses"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "lenses": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "vendor",
          "model",
          "source_url",
          "source_date"
        ],
        "properties": {
          "vendor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 160
          },
          "product_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "pattern": "^https://",
            "maxLength": 1000
          },
          "source_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://",
            "maxLength": 1000
          },
          "source_date": {
            "type": "string",
            "format": "date"
          },
          "diameter_mm": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0.001,
            "maximum": 5000
          },
          "clear_aperture_mm": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0.001,
            "maximum": 5000
          },
          "focal_length_mm": {
            "type": [
              "number",
              "null"
            ],
            "minimum": -100000,
            "maximum": 100000,
            "description": "有符号焦距，不能为0；未知用null"
          },
          "back_focal_length_mm": {
            "type": [
              "number",
              "null"
            ],
            "minimum": -100000,
            "maximum": 100000
          },
          "radii_mm": {
            "type": [
              "array",
              "null"
            ],
            "minItems": 1,
            "maxItems": 24,
            "items": {
              "type": [
                "number",
                "null"
              ],
              "minimum": -10000000.0,
              "maximum": 10000000.0
            },
            "description": "光沿局部+z，依次列曲率；数组内null明确为平面，不使用0；整组未知则整个字段null"
          },
          "thicknesses_mm": {
            "type": [
              "array",
              "null"
            ],
            "minItems": 1,
            "maxItems": 23,
            "items": {
              "type": "number",
              "minimum": 0.001,
              "maximum": 1000
            }
          },
          "glass": {
            "type": [
              "array",
              "null"
            ],
            "minItems": 1,
            "maxItems": 23,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          "coating": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "price": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "amount",
              "currency",
              "quantity",
              "unit",
              "observed_date",
              "price_type"
            ],
            "properties": {
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000.0
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "quantity": {
                "type": "number",
                "minimum": 0.001,
                "maximum": 1000000.0
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "observed_date": {
                "type": "string",
                "format": "date"
              },
              "price_type": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "shipping_amount": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "maximum": 10000000.0
              }
            }
          }
        }
      }
    }
  }
}