import 'dart:io';

import 'package:flutter/material.dart';

import '../../../../state/app/modules/app_modules.dart';
import '../../../../storage/chat_background_settings.dart';
import '../../../../storage/dev_tools_settings.dart';
import '../../../../storage/file_settings.dart';
import '../../../../storage/file_view_settings.dart';
import '../../../../storage/haptic_settings.dart';
import '../../../../storage/holidays_settings.dart';
import '../../../../storage/modules_settings.dart';
import '../../../../storage/notification_settings.dart';
import '../../../../storage/settings.dart';
import '../../../../storage/talk_settings.dart';
import '../../../../storage/timetable_favorites_settings.dart';
import '../../../../storage/timetable_settings.dart';
import '../../../../view/pages/timetable/data/timetable_name_mode.dart';
import '../../files/data/sort_options.dart';

class DefaultSettings {
  static Settings get() => Settings(
    appTheme: ThemeMode.system,
    devToolsEnabled: false,
    modulesSettings: ModulesSettings(
      moduleOrder: [
        Modules.timetable,
        Modules.ticker,
        Modules.talk,
        Modules.files,
        Modules.marianumMessage,
        Modules.roomPlan,
        Modules.gradeAveragesCalculator,
        Modules.holidays,
        Modules.marianumDates,
      ],
      hiddenModules: [],
      autoFillBottomBar: true,
      fixedBottomBarSlots: 3,
    ),
    timetableSettings: TimetableSettings(
      connectDoubleLessons: true,
      timetableNameMode: TimetableNameMode.name,
    ),
    timetableFavoritesSettings: TimetableFavoritesSettings(favorites: []),
    talkSettings: TalkSettings(
      sortFavoritesToTop: true,
      sortUnreadToTop: false,
      drafts: {},
      draftReplies: {},
    ),
    chatBackgroundSettings: ChatBackgroundSettings(
      // Mirrors the previous hard-coded behaviour: tiled pattern, no effects.
      type: ChatBackgroundType.pattern,
      fit: ChatBackgroundFit.tile,
      colorValue: null,
      imageVersion: 0,
      dim: 0,
      blur: 0,
    ),
    fileSettings: FileSettings(
      sortFoldersToTop: true,
      ascending: true,
      sortBy: SortOption.name,
    ),
    holidaysSettings: HolidaysSettings(
      dismissedDisclaimer: false,
      showPastEvents: false,
    ),
    fileViewSettings: FileViewSettings(alwaysOpenExternally: Platform.isIOS),
    notificationSettings: NotificationSettings(enabled: true),
    devToolsSettings: DevToolsSettings(
      checkerboardOffscreenLayers: false,
      checkerboardRasterCacheImages: false,
      showPerformanceOverlay: false,
      marianumConnectEndpoint: MarianumConnectEndpoint.live,
      marianumConnectCustomUrl: '',
      emergencyNoticeUrl: '',
    ),
    hapticSettings: HapticSettings(level: HapticLevel.full),
  );
}
