enum RepositoryFullscreenSettings { landscape, flexible, off }
enum RepositorySkinColor { white }
enum RepositoryVideoQuality { auto, p2160, p1440, p1080, p720, p480, p360, p240, p144  }
enum RepositoryVideoQualityNaming { common, rus, eng, resolution }

enum RepositoryLogType { off, info, debug }
extension RepositoryLogTitle on RepositoryLogType {
  String get key {
    switch (this) {
      case RepositoryLogType.info:
        return "info";
      case RepositoryLogType.debug:
        return "debug";
      case RepositoryLogType.off:
        return "off";
    }
  }
}

extension RepositoryVideoQualityIdentifier on RepositoryVideoQuality {
  String get identifier {
    switch (this) {
      case RepositoryVideoQuality.auto:
        return "auto";
      case RepositoryVideoQuality.p144:
        return "p144";
      case RepositoryVideoQuality.p240:
        return "p240";
      case RepositoryVideoQuality.p360:
        return "p360";
      case RepositoryVideoQuality.p480:
        return "p480";
      case RepositoryVideoQuality.p720:
        return "p720";
      case RepositoryVideoQuality.p1080:
        return "p1080";
      case RepositoryVideoQuality.p1440:
        return "p1440";
      case RepositoryVideoQuality.p2160:
        return "p2160";
    }
  }
}

class SettingsRepository {
  late bool isSkinByDefault;

  late RepositoryFullscreenSettings fullscreenSettings;
  late bool isPipAvailable;
  late bool isSettingsAvailable;
  late RepositorySkinColor skinColor;

  late bool isAutostart;
  late double volume;
  late double brightness;
  late double speed;
  late RepositoryVideoQualityNaming qualityNaming;
  late RepositoryVideoQuality quality;
  late bool isSubtitlesAvailable;
  late int start;

  late bool isLoop;

  late int playlist;
  late int track;
  late int chunk;

  late RepositoryLogType log;

  SettingsRepository({
    required this.isSkinByDefault,
    required this.fullscreenSettings,
    required this.isPipAvailable,
    required this.isSettingsAvailable,
    required this.skinColor,
    required this.isAutostart,
    required this.brightness,
    required this.volume,
    required this.speed,
    required this.qualityNaming,
    required this.quality,
    required this.isSubtitlesAvailable,
    required this.start,
    required this.isLoop,
    required this.playlist,
    required this.track,
    required this.chunk,
    required this.log
  });

  factory SettingsRepository.createDefaults(double brightness) {
    return SettingsRepository(
        isSkinByDefault: true,
        fullscreenSettings: RepositoryFullscreenSettings.landscape,
        isPipAvailable: true,
        isSettingsAvailable: true,
        skinColor: RepositorySkinColor.white,
        isAutostart: false,
        brightness: brightness,
        volume: 0.5,
        speed: 1,
        qualityNaming: RepositoryVideoQualityNaming.common,
        quality: RepositoryVideoQuality.auto,
        isSubtitlesAvailable: true,
        start: 0,
        isLoop: false,
        playlist: 5000,
        track: 3000,
        chunk: 3000,
        log: RepositoryLogType.info
    );
  }
}