{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://bestaisubscriptions.com/schema.json",
  "title": "AI subscriptions (US, USD)",
  "type": "object",
  "required": [
    "schema_version",
    "market",
    "currency",
    "generated_at",
    "services"
  ],
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "market": {
      "const": "US"
    },
    "currency": {
      "const": "USD"
    },
    "generated_at": {
      "type": "string",
      "format": "date"
    },
    "services_count": {
      "type": "integer"
    },
    "categories": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "services": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/definitions/service"
      }
    }
  },
  "definitions": {
    "price": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0
    },
    "strings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "capability": {
      "type": [
        "boolean",
        "null",
        "string"
      ]
    },
    "plan": {
      "type": "object",
      "required": [
        "id",
        "name",
        "price_monthly_usd",
        "price_annual_per_month_usd"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "price_monthly_usd": {
          "$ref": "#/definitions/price"
        },
        "price_annual_per_month_usd": {
          "$ref": "#/definitions/price"
        },
        "usage": {
          "type": [
            "string",
            "null"
          ]
        },
        "features": {
          "$ref": "#/definitions/strings"
        },
        "models": {
          "$ref": "#/definitions/strings"
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "price_local": {
          "type": [
            "object",
            "null"
          ],
          "description": "Price in the vendor's own currency when no USD price is published",
          "required": [
            "currency"
          ],
          "properties": {
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "monthly": {
              "$ref": "#/definitions/price"
            },
            "annual_per_month": {
              "$ref": "#/definitions/price"
            }
          }
        }
      }
    },
    "service": {
      "type": "object",
      "required": [
        "id",
        "name",
        "vendor",
        "category",
        "pricing_url",
        "plans",
        "capabilities",
        "sources",
        "confidence",
        "free_tier",
        "verified_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "name": {
          "type": "string"
        },
        "vendor": {
          "type": "string"
        },
        "category": {
          "enum": [
            "assistant",
            "search",
            "browser",
            "coding",
            "app-builder",
            "agent",
            "image",
            "video",
            "voice",
            "music",
            "productivity",
            "writing",
            "meetings",
            "research",
            "education",
            "companion"
          ]
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "pricing_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "free_tier": {
          "type": "boolean"
        },
        "starting_price_usd": {
          "$ref": "#/definitions/price"
        },
        "starting_price_basis": {
          "enum": [
            "monthly",
            "annual",
            null
          ]
        },
        "plans": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/plan"
          }
        },
        "capabilities": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/capability"
          },
          "properties": {
            "memory_portability": {
              "type": [
                "object",
                "null"
              ],
              "required": [
                "import",
                "export"
              ],
              "properties": {
                "import": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "export": {
                  "enum": [
                    "native",
                    "prompt",
                    "account_data",
                    null
                  ]
                },
                "import_from": {
                  "$ref": "#/definitions/strings"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "bundle": {
          "$ref": "#/definitions/strings"
        },
        "student_discount": {
          "type": [
            "string",
            "null"
          ]
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "url",
              "method",
              "checked_at"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "method": {
                "type": "string"
              },
              "checked_at": {
                "type": "string",
                "format": "date"
              }
            }
          }
        },
        "verified_at": {
          "type": "string",
          "format": "date"
        },
        "confidence": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        }
      }
    }
  }
}