/* eslint-disable @suno-custom/no-react-icons -- grandfathered in, need to migrate */
import {
  FaArrowDown,
  FaBook,
  FaCoffee,
  FaCog,
  FaCompactDisc,
  FaFlask,
  FaGamepad,
  FaGuitar,
  FaHeadphones,
  FaHeart,
  FaLeaf,
  FaMonument,
  FaMusic,
  FaSpinner,
  FaTree,
  FaWaveSquare,
} from 'react-icons/fa';
import { FaCloudMoon } from 'react-icons/fa6';
import {
  GiDrumKit,
  GiGrandPiano,
  GiMagicBroom,
  GiMicrophone,
  GiSaxophone,
  GiViolin,
} from 'react-icons/gi';
import { LuPartyPopper } from 'react-icons/lu';
import { MdPiano, MdSelfImprovement } from 'react-icons/md';
import { PiVinylRecord, PiWaveSineLight } from 'react-icons/pi';

/* eslint-enable @suno-custom/no-react-icons */

export const SONG_STYLES = [
  'Chill',
  'Ambient',
  'Piano',
  'Guitar',
  'Classical',
  'Lo-Fi',
  'Jazz',
  'Indie',
  'Meditation',
  'Downtempo',
  'Bossa Nova',
  'Neo-soul',
  'R&B',
  'Violin',
  'Blues',
  'Acoustic',
  'Reggae',
  'Chillwave',
  'Retro',
  'Funk',
  'Techno',
  'Breakbeat',
  'Synthwave',
  'Experimental',
  'Trance',
  'Disco',
  '8-bit',
  'Orchestral',
  'Ethereal',
  'Study',
  'Nature',
  'Mystical',
  'Baroque',
  'House',
] as const;

export const SONG_STYLE_ICONS = {
  Chill: FaLeaf,
  Ambient: FaCloudMoon,
  Piano: MdPiano,
  Guitar: FaGuitar,
  Classical: GiGrandPiano,
  'Lo-Fi': FaHeadphones,
  Jazz: GiSaxophone,
  Indie: FaGuitar,
  Meditation: MdSelfImprovement,
  Downtempo: FaArrowDown,
  'Bossa Nova': FaCoffee,
  'Neo-soul': FaHeart,
  'R&B': GiMicrophone,
  Violin: GiViolin,
  Blues: GiMicrophone,
  Acoustic: FaGuitar,
  Reggae: FaGuitar,
  Chillwave: PiWaveSineLight,
  Retro: PiVinylRecord,
  Funk: FaCompactDisc,
  Techno: FaCog,
  Breakbeat: GiDrumKit,
  Synthwave: FaWaveSquare,
  Experimental: FaFlask,
  Trance: FaSpinner,
  Disco: LuPartyPopper,
  '8-bit': FaGamepad,
  Orchestral: FaMusic,
  Ethereal: GiMagicBroom,
  Study: FaBook,
  Nature: FaTree,
  Mystical: GiMagicBroom,
  Baroque: FaMonument,
  House: GiDrumKit,
} as const;

export type SongStyle = (typeof SONG_STYLES)[number];
export const SUNOVERSE_WEB_FEATURE_FLAG = 'sunoverse-web';

// Style colors for winning styles and voting options
export const STYLE_COLORS = [
  'text-blue-500',
  'text-red-500',
  'text-green-500',
  'text-pink-500',
] as const;

// Simple color names for chat metadata
export const STYLE_COLOR_NAMES = ['blue', 'red', 'green', 'pink'] as const;

// Map color names to Tailwind classes
export const COLOR_MAP: { [key: string]: string } = {
  blue: 'text-blue-500',
  red: 'text-red-500',
  green: 'text-green-500',
  pink: 'text-pink-500',
};

// Default colors for vote messages
const DEFAULT_STYLE_COLOR = 'text-white';

// Helper function to get style color class from color name
export const getStyleColorClass = (
  colorName: string | null | undefined
): string => {
  if (!colorName) {
    return DEFAULT_STYLE_COLOR;
  }
  return COLOR_MAP[colorName] || DEFAULT_STYLE_COLOR;
};

// Helper function to get style color by index
export const getStyleColorByIndex = (index: number): string => {
  return STYLE_COLORS[index % STYLE_COLORS.length];
};

// Helper function to get style color name by index
export const getStyleColorNameByIndex = (index: number): string => {
  return STYLE_COLOR_NAMES[index % STYLE_COLOR_NAMES.length];
};

// Sync check interval in milliseconds
export const SYNC_CHECK_INTERVAL = 5000;

// Query refetch intervals in milliseconds
export const SONGS_REFETCH_INTERVAL_NORMAL = 15000; // 15 seconds
export const SONGS_REFETCH_INTERVAL_NEAR_END = 2000; // 2 seconds
export const SONGS_STALE_TIME = 5 * 60 * 1000; // 5 minutes
export const VOTE_STATUS_REFETCH_INTERVAL = 5000; // 5 seconds

// Playlist end threshold in seconds
export const PLAYLIST_END_THRESHOLD_SECONDS = 15; // Start frequent refetching before playlist ends

// Video fallback timeout in milliseconds
export const VIDEO_FALLBACK_TIMEOUT = 5000; // 5 seconds

// Fallback duration for streaming songs with 0 duration (in seconds)
export const STREAMING_FALLBACK_DURATION = 6000; // 6000 seconds = 100 minutes

// Floating message animation duration in milliseconds
export const FLOATING_MESSAGE_DURATION = 20000; // seconds

export const STATION_ID = 'thebetterdefault';

export const VOTE_CLOSES_BEFORE_END = 20; // 20 seconds before the song ends
