// Core Item Types
export interface CuratedItem {
  id: string
  title: string
  price: number
  originalPrice?: number
  category: 'photography' | 'music' | 'books' | 'design'
  ebayUrl: string
  images: string[]
  condition: 'new' | 'like-new' | 'excellent' | 'very-good' | 'good' | 'acceptable'
  rarity: 1 | 2 | 3 | 4 | 5
  expertNotes: string
  dateAdded: Date
  featured: boolean
  tags: string[]
  seller: {
    name: string
    rating: number
    feedback: number
  }
  shipping: {
    cost: number
    location: string
    international: boolean
  }
  authenticity: {
    verified: boolean
    notes?: string
  }
}

// User & Gamification Types
export interface UserProfile {
  id: string
  email: string
  username: string
  avatar?: string
  level: number           // Collector Level (1-50)
  xp: number             // Experience Points
  badges: Badge[]        // Achievement Badges
  collections: Collection[]
  wishlist: string[]     // Item IDs
  streak: number         // Daily visit streak
  preferences: UserPreferences
  joinDate: Date
  lastActive: Date
}

export interface Badge {
  id: string
  name: string           // "Vinyl Virtuoso", "Camera Connoisseur"
  description: string
  icon: string
  rarity: 'common' | 'rare' | 'legendary'
  unlockedAt?: Date
  progress?: {
    current: number
    required: number
  }
}

export interface Collection {
  id: string
  name: string
  description: string
  items: string[]        // Item IDs
  isPublic: boolean
  createdAt: Date
  updatedAt: Date
}

export interface UserPreferences {
  categories: string[]
  priceRange: {
    min: number
    max: number
  }
  notifications: {
    email: boolean
    push: boolean
    priceAlerts: boolean
    newFinds: boolean
    weeklyDigest: boolean
  }
  privacy: {
    showCollections: boolean
    showActivity: boolean
  }
}

// Search & Filter Types
export interface SearchFilters {
  query?: string
  category?: string
  priceMin?: number
  priceMax?: number
  condition?: string[]
  rarity?: number[]
  tags?: string[]
  sortBy?: 'date' | 'price-low' | 'price-high' | 'rarity' | 'popularity'
  featured?: boolean
}

export interface SearchResult {
  items: CuratedItem[]
  total: number
  page: number
  hasMore: boolean
  filters: SearchFilters
}

// Newsletter Types
export interface NewsletterSubscriber {
  id: string
  email: string
  status: 'active' | 'pending' | 'unsubscribed'
  segments: string[]     // ['photography', 'music', 'books', 'design']
  subscribedAt: Date
  preferences: {
    frequency: 'daily' | 'weekly' | 'monthly'
    categories: string[]
  }
}

// Price Alert Types
export interface PriceAlert {
  id: string
  userId: string
  itemId: string
  targetPrice: number
  isActive: boolean
  createdAt: Date
  triggeredAt?: Date
}

// Activity & Analytics Types
export interface UserActivity {
  id: string
  userId: string
  type: 'view' | 'wishlist' | 'share' | 'click' | 'search'
  itemId?: string
  metadata?: Record<string, any>
  timestamp: Date
}

// API Response Types
export interface ApiResponse<T> {
  success: boolean
  data?: T
  error?: string
  message?: string
}

export interface PaginatedResponse<T> {
  items: T[]
  total: number
  page: number
  limit: number
  hasMore: boolean
}

// Component Props Types
export interface ItemCardProps {
  item: CuratedItem
  showWishlist?: boolean
  showExpertNotes?: boolean
  compact?: boolean
}

export interface SearchBarProps {
  onSearch: (query: string) => void
  placeholder?: string
  showFilters?: boolean
}

export interface WishlistButtonProps {
  itemId: string
  isWishlisted: boolean
  onToggle: (itemId: string) => void
}