import 'package:flutter/material.dart';

const kSettingsTabGeneral = 'general';
const kSettingsTabPlayback = 'playback';
const kSettingsTabGestures = 'gestures';
const kSettingsTabAudio = 'audio';
const kSettingsTabDanmaku = 'danmaku';
const kSettingsTabModules = 'modules';
const kSettingsTabTmdb = 'tmdb';
const kSettingsTabTrakt = 'trakt';
const kSettingsTabIconLibrary = 'icon-library';

typedef SettingsTabData = ({String label, IconData icon});

const settingsTabData = <SettingsTabData>[
  (label: '通用', icon: Icons.tune_outlined),
  (label: '播放', icon: Icons.play_circle_outline_rounded),
  (label: '音频', icon: Icons.headphones_outlined),
  (label: '弹幕', icon: Icons.subtitles_outlined),
  (label: '模块', icon: Icons.extension_rounded),
  (label: 'TMDB', icon: Icons.movie_filter_outlined),
  (label: 'Trakt', icon: Icons.link_outlined),
  (label: '图标库', icon: Icons.palette_outlined),
];

int settingsTabIndexFromKey(String? key) => switch (key) {
  kSettingsTabGeneral => 0,
  kSettingsTabPlayback => 1,
  kSettingsTabGestures => 1,
  kSettingsTabAudio => 2,
  kSettingsTabDanmaku => 3,
  kSettingsTabModules => 4,
  kSettingsTabTmdb => 5,
  kSettingsTabTrakt => 6,
  kSettingsTabIconLibrary => 7,
  _ => 0,
};

String? settingsTabKeyFromIndex(int index) => switch (index) {
  0 => kSettingsTabGeneral,
  1 => kSettingsTabPlayback,
  2 => kSettingsTabAudio,
  3 => kSettingsTabDanmaku,
  4 => kSettingsTabModules,
  5 => kSettingsTabTmdb,
  6 => kSettingsTabTrakt,
  7 => kSettingsTabIconLibrary,
  _ => null,
};
