// 사용자 및 구독 관련 타입 정의

export interface User {
  id: string;
  email: string;
  name?: string;
  avatar?: string;
  createdAt: Date;
  lastLoginAt: Date;
  subscription: Subscription;
  preferences: UserPreferences;
}

export interface Subscription {
  plan: SubscriptionPlan;
  status: "active" | "cancelled" | "expired";
  currentPeriodStart: Date;
  currentPeriodEnd: Date;
  usage: Usage;
}

export type SubscriptionPlan = "free" | "lite" | "pro" | "enterprise";

export interface PlanLimits {
  aiQueries: number;
  cellCount: number;
  canDownload: boolean;
  canCopy: boolean;
  maxFileSize: number; // MB
}

export interface Usage {
  aiQueries: number;
  cellCount: number;
  resetDate: Date;
}

export interface UserPreferences {
  language: "ko" | "en";
  historyPanelPosition: "left" | "right";
  autoSave: boolean;
  showAnimations: boolean;
}

export const PLAN_LIMITS: Record<SubscriptionPlan, PlanLimits> = {
  free: {
    aiQueries: 30,
    cellCount: 300,
    canDownload: false,
    canCopy: false,
    maxFileSize: 10,
  },
  lite: {
    aiQueries: 100,
    cellCount: 1000,
    canDownload: true,
    canCopy: true,
    maxFileSize: 10,
  },
  pro: {
    aiQueries: 500,
    cellCount: 5000,
    canDownload: true,
    canCopy: true,
    maxFileSize: 50,
  },
  enterprise: {
    aiQueries: Infinity,
    cellCount: Infinity,
    canDownload: true,
    canCopy: true,
    maxFileSize: Infinity,
  },
};
