export type Role = 'admin' | 'user';

export type OrderStatus = 'pending_payment' | 'paid' | 'processing' | 'completed' | 'cancelled';
export type PaymentStatus = 'pending' | 'paid' | 'failed';
export type DiscountType = 'percent' | 'fixed';

export interface User {
  id: string;
  name: string;
  email: string;
  mobile: string;
  role: Role;
  isActive: boolean;
  createdAt: string;
}

export interface Category {
  id: string;
  name: string;
  slug: string;
  icon: string;
  description?: string;
  isActive: boolean;
  sortOrder: number;
  productCount?: number;
  createdAt: string;
}

export interface Product {
  id: string;
  title: string;
  slug: string;
  categoryId: string;
  categoryName?: string;
  price: number;
  originalPrice?: number;
  discountPercent?: number;
  description: string;
  features: string[];
  tags: string[];
  image: string;
  badge?: string;
  inStock: boolean;
  stockCount: number;
  isFeatured?: boolean;
  isBestSeller?: boolean;
  platform?: 'steam' | 'playstation' | 'xbox' | 'software' | 'music' | 'gaming_service';
  regions?: string[];
  deliveryType?: 'instant_code' | 'account_details' | 'manual_config';
  deliveryNote?: string;
  createdAt: string;
  updatedAt?: string;
}

export interface Coupon {
  id: string;
  code: string;
  discountType: DiscountType;
  discountValue: number;
  minPurchase: number;
  maxDiscount?: number;
  maxUses: number;
  usedCount: number;
  isActive: boolean;
  startDate?: string;
  endDate?: string;
  createdAt: string;
}

export interface CartItem {
  product: Product;
  quantity: number;
  selectedRegion?: string;
}

export interface OrderItem {
  productId: string;
  title: string;
  region?: string;
  price: number;
  originalPrice?: number;
  quantity: number;
  image: string;
}

export interface GuestInfo {
  name: string;
  mobile: string;
  email: string;
  notes?: string;
}

export interface Order {
  id: string;
  orderNumber: string;
  userId?: string;
  guestInfo: GuestInfo;
  items: OrderItem[];
  subtotal: number;
  discountAmount: number;
  couponCode?: string;
  finalTotal: number;
  paymentMethod: string;
  paymentStatus: PaymentStatus;
  orderStatus: OrderStatus;
  licenseKeys?: string[];
  deliveryInstructions?: string;
  createdAt: string;
  updatedAt: string;
}

export interface Tutorial {
  id: string;
  title: string;
  platform: 'Windows' | 'Android' | 'iOS';
  description: string;
  aparatUrl: string;
  embedUrl?: string;
  thumbnail?: string;
  active: boolean;
  createdAt: string;
  updatedAt?: string;
}

export interface DashboardStats {
  totalSales: number;
  totalOrders: number;
  pendingOrders: number;
  completedOrders: number;
  totalUsers: number;
  totalProducts: number;
  recentOrders: Order[];
  topProducts: {
    productId: string;
    title: string;
    salesCount: number;
    revenue: number;
  }[];
}

export interface FilterOptions {
  categoryId?: string;
  search?: string;
  sort?: 'newest' | 'price_asc' | 'price_desc' | 'popular' | 'discount';
  minPrice?: number;
  maxPrice?: number;
  inStockOnly?: boolean;
  isFeatured?: boolean;
}
