/**
 * Types additionnels de veza_frontend_web_v2 et veza_frontend_web_v3
 * Merged into apps/web for compatibility
 */

import { Track } from './api';
import { Product, ProductLicense, Review } from './marketplace';
import React from 'react';

// Theme Variants
export enum ThemeVariant {
  NEON = 'neon',
  GAMING = 'gaming',
  NATURE = 'nature',
  TERMINAL = 'terminal',
  LIGHT = 'light',
}

// ProductDTO
export interface ProductDTO {
  id: string;
  title: string;
  description?: string;
  price: number;
  currency: string;
  product_type: 'track' | 'pack' | 'service';
  license_type: 'standard' | 'exclusive' | 'commercial';
  status: 'draft' | 'active' | 'archived';
  seller_id: string;
  track_id?: string;
  created_at: string;
}

export interface Purchase {
  id: string;
  orderId: string;
  date: string;
  price: number;
  status: string;
  product: Product;
  license: ProductLicense;
  downloadUrl?: string;
}

export interface UploadState {
  progress: number;
  status: 'uploading' | 'processing' | 'completed' | 'error';
  uploadId?: string;
}

export interface Comment {
  id: string;
  author: {
    name: string;
    avatar: string;
    handle: string;
  };
  content: string;
  timestamp: string;
  likes: number;
  replies?: Comment[];
}

export interface Post {
  id: string;
  author: {
    name: string;
    avatar: string;
    handle: string;
    isVerified?: boolean;
    role?: string;
  };
  content: string;
  timestamp: string;
  likes: number;
  comments: number;
  shares: number;
  image?: string;
  audioTrack?: Track;
  type: 'text' | 'image' | 'audio' | 'video' | 'poll';
  isRepost?: boolean;
  repostAuthor?: string;
  tags?: string[];
  pollOptions?: { label: string; votes: number }[];
  recentComments?: Comment[];
  isLiked?: boolean;
}

export interface NavItem {
  id: string;
  label: string;
  icon: React.ReactNode;
  badge?: number;
}

export interface Achievement {
  id: string;
  name: string;
  description: string;
  icon: string;
  progress: number;
  maxProgress: number;
  xpReward: number;
  category: 'social' | 'creation' | 'collection' | 'community';
}

export interface LeaderboardEntry {
  rank: number;
  userId: string;
  username: string;
  avatar: string;
  level: number;
  xp: number;
  trend: number;
}

export interface LiveStream {
  id: string;
  title: string;
  streamer: string;
  viewers: number;
  thumbnailUrl: string;
  tags: string[];
  isLive: boolean;
  category: 'DJ Set' | 'Production' | 'Review' | 'Q&A';
  uptime?: string;
}

export interface GearItem {
  id: string;
  name: string;
  category: string;
  brand: string;
  model: string;
  serialNumber?: string;
  image?: string;
  images?: string[];
  status: 'Active' | 'Maintenance' | 'Sold' | 'Wishlist';
  condition: 'Mint' | 'Good' | 'Fair' | 'Poor';
  purchaseDate: string;
  purchasePrice: number;
  currency: 'USD' | 'EUR' | 'GBP';
  vendor?: string;
  orderNumber?: string;
  warrantyExpire?: string;
  warrantyType?: 'Manufacturer' | 'Extended' | 'None';
  supportContact?: string;
  specs?: Record<string, string>;
  notes?: string;
  documents?: {
    name: string;
    type: 'manual' | 'receipt' | 'firmware';
    url: string;
    size?: string;
  }[];
  maintenanceHistory?: {
    id: string;
    date: string;
    type: string;
    notes: string;
    cost?: number;
    provider?: string;
  }[];
}

export interface CartItem extends Product {
  cartId: string;
  selectedLicense?: ProductLicense;
}

// Education Types
export interface Course {
  id: string;
  title: string;
  description?: string;
  instructor: string;
  thumbnailUrl: string;
  duration: string;
  level: 'Beginner' | 'Intermediate' | 'Advanced';
  rating?: number;
  studentCount?: number;
  price?: number;
  progress?: number;
  modules?: Module[];
  certificateAvailable?: boolean;
  lastAccessed?: string;
  whatYouWillLearn?: string[];
  requirements?: string[];
  reviews?: Review[];
  tags?: string[];
}

export interface Module {
  id: string;
  title: string;
  lessons: Lesson[];
}

export interface Lesson {
  id: string;
  title: string;
  duration: string;
  type: 'video' | 'article' | 'quiz';
  isLocked?: boolean;
  content?: string;
  quizId?: string;
}

export interface Quiz {
  id: string;
  title: string;
  passingScore: number;
  questions: {
    id: string;
    question: string;
    options: string[];
    correctIndex: number;
  }[];
}

export interface Album {
  id: string;
  title: string;
  artist: string;
  coverUrl: string;
  releaseDate: string;
}

// Analytics Types
export interface AnalyticsMetric {
  id: string;
  label: string;
  value: string | number;
  trend?: number;
  color?: string;
  sparklineData?: number[];
}

export interface WidgetConfig {
  id: string;
  type: string;
  title: string;
}

export interface DashboardLayout {
  id: string;
  widgets: WidgetConfig[];
}

// Chat Types (v2/v3 specific)
export interface Channel {
  id: string;
  name: string;
  type: 'text' | 'voice';
  unread?: number;
  isLocked?: boolean;
  topic?: string;
  activeParticipants?: VoiceParticipant[];
}

export interface VoiceParticipant {
  id: string;
  name: string;
  avatar: string;
  isMuted?: boolean;
  isSpeaking?: boolean;
  isScreenSharing?: boolean;
  roleColor?: string;
}

export interface Server {
  id: string;
  name: string;
  icon: string;
  categories: {
    id: string;
    name: string;
    channels: Channel[];
  }[];
}

export interface DirectMessage {
  id: string;
  user: {
    name: string;
    avatar: string;
    status: 'online' | 'idle' | 'dnd' | 'offline';
  };
  lastMessage: string;
  unread: number;
  timestamp: string;
}

// File System Types
export interface FileNode {
  id: string;
  name: string;
  type:
    | 'audio'
    | 'image'
    | 'video'
    | 'folder'
    | 'archive'
    | 'document'
    | 'project';
  size: string;
  modified: string;
  status: 'ready' | 'processing' | 'archived';
  metadata?: Record<string, string | number | undefined>;
  tags?: string[];
}

// Social Group
export interface SocialGroup {
  id: string;
  name: string;
  members: number;
  isPrivate: boolean;
  userRole: 'admin' | 'mod' | 'member' | 'none';
  description: string;
  coverUrl: string;
}

// Backup
export interface Backup {
  id: string;
  date: string;
  type: 'Full' | 'Incremental';
  size: string;
  status: 'Success' | 'Failed';
  location: string;
}

// Report
export interface Report {
  id: string;
  targetId: string;
  targetType: 'user' | 'track' | 'comment' | 'group';
  targetName: string;
  reason: string;
  description: string;
  reportedBy: string;
  status: 'pending' | 'reviewed' | 'resolved' | 'dismissed';
  timestamp: string;
}

// Project (Studio)
export interface Project {
  id: string;
  name: string;
  daw: string;
  bpm: string | number;
  key: string;
  status: string;
  collaborators: number;
  modified: string;
  progress: number;
}
