{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "rstack.dev/profile/v1alpha1",
  "title": "RStack Profile resource",
  "description": "Kubernetes-style resource projection of a delivery profile. Derived from BUILT_IN_PROFILES and budgetPolicyForProfile in src/core/profiles.js. The three built-in profiles are business-flex, enterprise-webapp, and lean-mvp; a project may override any field via .rstack/rstack.config.json (see rstack-project.schema.json).",
  "type": "object",
  "required": ["apiVersion", "kind", "metadata", "spec"],
  "properties": {
    "apiVersion": { "const": "rstack.dev/v1alpha1" },
    "kind": { "const": "Profile" },
    "metadata": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "name": { "type": "string", "description": "Profile slug. Built-ins: business-flex | enterprise-webapp | lean-mvp." }
      },
      "additionalProperties": true
    },
    "spec": {
      "type": "object",
      "required": ["profile"],
      "properties": {
        "profile": { "type": "string", "enum": ["business-flex", "enterprise-webapp", "lean-mvp"], "description": "KNOWN_PROFILES — an unknown profile in config warns and falls back to business-flex." },
        "name": { "type": "string" },
        "description": { "type": "string" },
        "enabled_domains": { "type": "array", "items": { "type": "string" } },
        "enabled_agents": { "type": "array", "items": { "type": "string" } },
        "enabled_plugins": { "type": "array", "items": { "type": "string" } },
        "workflow": { "type": "string" },
        "dashboard_pages": { "type": "array", "items": { "type": "string" } },
        "business_stage_order": { "type": "array", "items": { "type": "string" } },
        "budget_policy": {
          "type": "object",
          "description": "budgetPolicyForProfile output, overridable via .rstack/budget.json (validateBudgetConfig).",
          "properties": {
            "currency": { "type": "string" },
            "run_budget_usd": { "type": "number", "minimum": 0 },
            "daily_budget_usd": { "type": "number", "minimum": 0 },
            "monthly_budget_usd": { "type": "number", "minimum": 0 },
            "warn_at_percent": { "type": "number" },
            "block_at_percent": { "type": "number" },
            "require_approval_above_usd": { "type": "number", "minimum": 0 },
            "model_policy": {
              "type": "object",
              "description": "Role/stage -> model strength hint (e.g. balanced | strong). Advisory: the host framework picks the model.",
              "additionalProperties": { "type": "string" }
            },
            "stage_budgets": {
              "type": "object",
              "description": "canonical-stage-id -> USD budget.",
              "additionalProperties": { "type": "number" }
            }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "status": { "type": "object", "additionalProperties": true }
  },
  "additionalProperties": true
}
