export type Plan = 'free' | 'pro' | 'pro_plus' | 'business' | 'enterprise';
export type SubscriptionStatus = 'active' | 'canceled' | 'trial' | 'past_due';

export interface UserSubscription {
  id: string;
  user_id: string;
  plan: Plan;
  status: SubscriptionStatus;
  current_period_start: string | null;
  current_period_end: string | null;
  stripe_customer_id: string | null;
  stripe_subscription_id: string | null;
  created_at: string;
  updated_at: string;
}

export interface AdminUser {
  id: string;
  user_id: string;
  granted_by: string | null;
  can_manage_subscriptions: boolean;
  can_manage_users: boolean;
  can_grant_admin: boolean;
  can_view_analytics: boolean;
  created_at: string;
  updated_at: string;
}

export type Feature =
  | 'unlimited_tasks'
  | 'unlimited_notes'
  | 'unlimited_projects'
  | 'ai_usage'
  | 'ai_advanced'
  | 'achievements_full'
  | 'automation'
  | 'team_features'
  | 'calendar_full'
  | 'customization_advanced'
  | 'priority_support';

export interface PlanLimits {
  maxTasks: number | null;       // null = unlimited
  maxNotes: number | null;
  maxProjects: number | null;
  maxAiRequestsPerMonth: number | null;
}

export interface PlanConfig {
  id: Plan;
  name: string;
  price: number | null;          // null = custom/enterprise
  priceLabel: string;
  description: string;
  features: Feature[];
  limits: PlanLimits;
  stripePriceId: string | null;
  highlighted?: boolean;
  badge?: string;
}
