{
  "openapi": "3.1.0",
  "info": {
    "title": "Sticklight Platform API",
    "description": "Public HTTP API for Sticklight platform services. The /plans endpoint is unauthenticated and returns live subscription plan prices and entitlements.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api-platform.sticklight.com/api/v1"
    }
  ],
  "paths": {
    "/plans": {
      "get": {
        "operationId": "getAllPlans",
        "summary": "Get all available plans",
        "description": "Returns public information about all available subscription plans.",
        "responses": {
          "200": {
            "description": "List of all available plans",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicPlan"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PublicPlan": {
        "type": "object",
        "required": ["id", "name", "type", "group", "entitlements", "prices"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique plan identifier"
          },
          "name": {
            "type": "string",
            "description": "Human-readable plan name"
          },
          "type": {
            "type": "string",
            "description": "Plan type"
          },
          "group": {
            "type": "string",
            "description": "Plan group"
          },
          "description": {
            "type": "string",
            "description": "Plan description"
          },
          "entitlements": {
            "type": "object",
            "description": "Feature entitlements for this plan",
            "additionalProperties": {
              "$ref": "#/components/schemas/EntitlementDefinition"
            },
            "example": {
              "custom-domain": { "enabled": true },
              "code-edit": { "enabled": true }
            }
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanPrice"
            }
          }
        }
      },
      "EntitlementDefinition": {
        "type": "object",
        "required": ["enabled"],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether the entitlement is enabled"
          },
          "value": {
            "description": "Optional value for the entitlement (number, string, array, or object)",
            "oneOf": [{ "type": "number" }, { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": true }]
          }
        }
      },
      "PlanPrice": {
        "type": "object",
        "required": ["id", "currency"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Price identifier (lookup key)"
          },
          "nickname": {
            "type": ["string", "null"]
          },
          "unitAmount": {
            "type": ["integer", "null"],
            "description": "Unit amount in the smallest currency unit"
          },
          "currency": {
            "type": "string"
          },
          "interval": {
            "type": ["string", "null"],
            "enum": ["day", "week", "month", "year", null]
          },
          "intervalCount": {
            "type": ["integer", "null"]
          },
          "metrics": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Error body returned by the operations in this spec on a non-2xx response",
        "required": ["statusCode", "timestamp", "path", "message"],
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "HTTP status code"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the error occurred (ISO 8601)"
          },
          "path": {
            "type": "string",
            "description": "Request path that produced the error"
          },
          "message": {
            "type": "string",
            "description": "Human-readable error message"
          },
          "code": {
            "type": "string",
            "description": "Optional machine-readable error code"
          }
        }
      }
    }
  }
}
