{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fluffystack.dev/v1/schemas/service-list.schema.json",
  "title": "FluffyStack Service List",
  "description": "Approved cloud services list exported from the FluffyStack Service Builder. Used as an interchange format for importing/exporting approved service catalogues between teams, CI pipelines, and governance tooling. This is the v1 schema — future backwards-incompatible changes will ship at /v2/schemas/service-list.schema.json, leaving v1 at this URL indefinitely so existing exports keep validating.",
  "type": "object",
  "required": ["$schema", "version", "metadata", "providers"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri",
      "description": "Pointer to this JSON Schema file. Consumers use it to discover validation rules.",
      "const": "https://fluffystack.dev/v1/schemas/service-list.schema.json"
    },
    "version": {
      "type": "string",
      "description": "Document format version. Parallels the schema version path segment; v1 schema emits '1.x' values.",
      "pattern": "^1\\.[0-9]+(\\.[0-9]+)?$"
    },
    "metadata": {
      "type": "object",
      "required": ["name", "lastUpdated", "providersCovered"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Human-readable title for the list (e.g. 'Platform Team Approved Services 2026')."
        },
        "description": {
          "type": "string",
          "description": "Optional free-text description of what this list is for and how to use it."
        },
        "organisation": {
          "type": "string",
          "description": "Optional owning organisation or business unit."
        },
        "owner": {
          "type": "string",
          "description": "Optional contact person or team responsible for the list."
        },
        "lastUpdated": {
          "type": "string",
          "format": "date",
          "description": "ISO 8601 date (YYYY-MM-DD) the list was last regenerated."
        },
        "providersCovered": {
          "type": "array",
          "description": "Short names of the providers represented in this list. Used as a quick summary without walking the full providers array.",
          "items": { "type": "string" },
          "uniqueItems": true
        },
        "cloudatlasListId": {
          "type": "string",
          "description": "Optional FluffyStack list identifier for shareable URLs (set when the list was saved via Save and Share)."
        }
      }
    },
    "providers": {
      "type": "array",
      "description": "Hierarchical grouping of approved services: provider → category → service. Only providers that contain at least one approved service are emitted.",
      "items": { "$ref": "#/$defs/providerGroup" }
    }
  },
  "$defs": {
    "providerGroup": {
      "type": "object",
      "required": ["id", "name", "shortName", "categories"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Provider identifier (e.g. 'aws', 'azure', 'openshift'). Kept as a string rather than a closed enum so consumers don't break when FluffyStack adds a new provider."
        },
        "name": {
          "type": "string",
          "description": "Full provider name (e.g. 'Amazon Web Services', 'Red Hat OpenShift')."
        },
        "shortName": {
          "type": "string",
          "description": "Brand short name for display (e.g. 'AWS', 'OpenShift')."
        },
        "categories": {
          "type": "array",
          "items": { "$ref": "#/$defs/categoryGroup" }
        }
      }
    },
    "categoryGroup": {
      "type": "object",
      "required": ["id", "name", "services"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Category identifier (e.g. 'compute', 'storage', 'ai-ml')."
        },
        "name": {
          "type": "string",
          "description": "Human-readable category name."
        },
        "services": {
          "type": "array",
          "items": { "$ref": "#/$defs/serviceEntry" }
        }
      }
    },
    "serviceEntry": {
      "type": "object",
      "required": [
        "id",
        "slug",
        "name",
        "shortName",
        "status",
        "category",
        "description",
        "vendorDocs",
        "serviceIcon",
        "hasFreeTier",
        "subServices"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "FluffyStack service id, typically '<provider>-<service>' (e.g. 'aws-ec2', 'openshift-rosa')."
        },
        "slug": {
          "type": "string",
          "description": "URL slug for the service. In current FluffyStack data this matches the id; future revisions may diverge, so consumers should treat them as independent."
        },
        "name": {
          "type": "string",
          "description": "Full product name as the vendor publishes it (e.g. 'Amazon Elastic Kubernetes Service')."
        },
        "shortName": {
          "type": "string",
          "description": "Common short name (e.g. 'EKS', 'ROSA')."
        },
        "status": {
          "type": "string",
          "enum": ["enabled", "restricted", "disabled"],
          "description": "Governance status. Services in a FluffyStack export default to 'enabled'; the other values are reserved for consumer tooling that layers its own policy on top."
        },
        "category": {
          "type": "string",
          "description": "Human-readable category label (e.g. 'Compute', 'Containers'). Repeats the parent categoryGroup name for convenience when flattening."
        },
        "description": {
          "type": "string",
          "description": "Short description of the service."
        },
        "vendorDocs": {
          "type": "string",
          "format": "uri",
          "description": "Canonical documentation URL from the vendor."
        },
        "serviceIcon": {
          "type": "string",
          "description": "Relative path to the service's icon asset within the FluffyStack site."
        },
        "hasFreeTier": {
          "type": "boolean",
          "description": "True if the vendor offers a free tier for this service."
        },
        "subServices": {
          "type": "array",
          "description": "Sub-products or features under the parent service (e.g. EC2 → Instances, Auto Scaling, Elastic IPs).",
          "items": {
            "type": "object",
            "required": ["id", "name", "description"],
            "additionalProperties": false,
            "properties": {
              "id": { "type": "string" },
              "name": { "type": "string" },
              "description": { "type": "string" }
            }
          }
        },
        "equivalents": {
          "type": "object",
          "description": "Cross-provider service equivalents keyed by provider id. A service that appears on every hyperscaler will have 10+ entries here; unique SaaS offerings may have none.",
          "propertyNames": {
            "type": "string",
            "description": "Provider id (e.g. 'aws', 'azure', 'openshift')."
          },
          "additionalProperties": { "type": "string" }
        }
      }
    }
  }
}
