{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/company/flutter-cursor-templates/brief-schema.json",
  "title": "project-brief.yaml",
  "description": "Schema for Flutter cursor_gen project brief — provides IDE autocomplete",
  "type": "object",
  "properties": {
    "cursor_templates_version": {
      "type": "string",
      "description": "Pillar 1: Pin to template version for reproducibility",
      "examples": ["1.0.5"]
    },
    "project": {
      "type": "object",
      "required": ["name", "package"],
      "properties": {
        "name":        { "type": "string", "description": "App display name" },
        "package":     { "type": "string", "description": "Dart package ID (e.g. com.company.appname)" },
        "description": { "type": "string" },
        "scale":       { "type": "string", "enum": ["small", "medium", "large"] }
      }
    },
    "stack": {
      "type": "object",
      "properties": {
        "state_management": {
          "type": "string",
          "enum": ["bloc", "riverpod", "getx", "hooks_riverpod"],
          "description": "Primary state management solution"
        },
        "routing": {
          "type": "string",
          "enum": ["gorouter", "getx_nav", "auto_route"]
        },
        "architecture": {
          "type": "string",
          "enum": ["clean", "feature_first", "mvvm", "mvc", "layered"]
        },
        "backend": {
          "type": "string",
          "description": "Single backend or combined with +: firebase, supabase, rest, firebase+rest",
          "examples": ["firebase", "supabase", "rest", "firebase+rest", "supabase+rest"]
        },
        "auth": {
          "type": "string",
          "enum": ["firebase_auth", "supabase_auth", "jwt_rest", "oauth2", "none"]
        },
        "platforms": {
          "type": "array",
          "items": { "type": "string", "enum": ["ios", "android", "web", "desktop"] },
          "description": "Pillar 4: Target platforms — affects generated rules"
        },
        "codegen": {
          "type": "array",
          "items": { "type": "string", "enum": ["freezed", "json_serializable", "injectable", "retrofit"] },
          "description": "Pillar 4: Code generation tools — affects generated rules"
        }
      }
    },
    "environments": {
      "type": "object",
      "properties": {
        "flavors": {
          "type": "array",
          "items": { "type": "string" },
          "examples": [["dev", "staging", "prod"]]
        },
        "cicd": {
          "type": "string",
          "enum": ["codemagic", "github_actions", "fastlane", "none"]
        }
      }
    },
    "testing": {
      "type": "object",
      "properties": {
        "depth": {
          "type": "string",
          "enum": ["unit_widget", "integration", "e2e", "full"]
        },
        "e2e_tool": {
          "type": "string",
          "enum": ["patrol", "maestro"]
        }
      }
    },
    "localization": {
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean" },
        "locales": { "type": "array", "items": { "type": "string" } }
      }
    },
    "design": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string",
          "enum": ["figma_mcp", "figma_manual", "native_ref", "html_ref", "none"]
        },
        "figma_url": { "type": "string" }
      }
    },
    "api_docs": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": ["openapi", "postman", "markdown", "none"]
        },
        "path": { "type": "string" }
      }
    },
    "references": {
      "type": "object",
      "description": "Other repos or local paths agents should treat as product context",
      "properties": {
        "repos": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Git remote URLs (https or ssh)"
        },
        "local_paths": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Repo-relative paths (e.g. monorepo packages) or other local references"
        }
      }
    },
    "features": {
      "type": "object",
      "properties": {
        "modules": { "type": "array", "items": { "type": "string" } },
        "special": { "type": "array", "items": { "type": "string" } }
      }
    },
    "app_context": {
      "type": "object",
      "description": "Theme targets and optional RBAC labels — mirrored to cursor-gen-metadata.json on generate",
      "properties": {
        "theme_variants": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["light", "dark", "high_contrast"]
          },
          "description": "Supported theme tokens; omit or leave empty to default to light + dark in the loader"
        },
        "roles_enabled": {
          "type": "boolean",
          "default": false,
          "description": "When true, list concrete roles in role_names"
        },
        "role_names": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Product role identifiers when roles_enabled is true"
        }
      }
    },
    "telemetry_opt_in": {
      "type": "boolean",
      "description": "Pillar 6: Opt-in local telemetry for rule trigger analytics",
      "default": false
    },
    "integrations": {
      "type": "object",
      "description": "Optional third-party integrations for generated Cursor config",
      "properties": {
        "mcp": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": false,
              "description": "When true, emit .cursor/mcp.json with env-placeholder server stubs only"
            },
            "preset": {
              "type": "string",
              "enum": ["auto", "minimal"],
              "default": "auto",
              "description": "minimal = empty mcpServers; auto = brief-derived stubs (still no committed secrets)"
            }
          }
        }
      }
    },
    "conventions": {
      "type": "object",
      "properties": {
        "strict_package_imports": {
          "type": "boolean",
          "default": false,
          "description": "When true, flutter-core rule enforces package: imports across feature boundaries"
        }
      }
    }
  }
}
