// CHANGELOG:
// 0.0.1 - implement screen
// 0.0.2 - implement logic
// 0.0.3 - first demo
// 0.0.4 - bug fix
// 0.0.5 - misc update
// 0.0.6 - fix scroe board problem
// 0.0.7 - add back button for listening practice, matching frenzy, connective revision
// 0.0.8 - add back button for listening practice card, matching frenzy card, connective revision card
// 0.0.9 - fix ticket 26,27,28,29
import { Capacitor } from '@capacitor/core';

import { ERR_POCKETBASE_URL_IS_EMPTY } from './ERRORS';

// 0.0.10 - remove debug symbol and re-route ending page
const VERSIONS = 'v0.0.10';
const HELLOWORLD_MP3 = '/helloworld.mp3';

// api
const API_URL = 'http://localhost:8080';

// route
const LISTENING_PRACTICE_LINK = '/listening_practice';
const MATCHING_FRENZY_LINK = '/matching_frenzy';
const FAVORITE_LINK = '/fav';
const LESSON_WORD_PAGE_LINK = '/lesson_word_page';
const CONNECTIVE_REVISION_LINK = '/connective_revision';
const LESSON_LINK = '/lesson';
const QUIZ_MAIN_MENU_LINK = '/quizzes_main_menu';
const RECORD_LINK = '/record';
const SETTING_LINK = '/setting';
const DEBUG_LINK = '/debug';
const MY_ACHIEVEMENT_LINK = '/my_achievement';

// achievement
const FULLMARK_COUNT_KEY = 'full_mark_count';
const APP_USE_TIME = 'app_use_time_s';
const LISTENING_PRACTICE_TIME_SPENT = 'listening_practice_time_spent_s';
const MATCHING_FRENZY_CORRECT_COUNT = 'matching_frenzy_correct_count';
const CONNECTIVES_REVISION_CORRECT_COUNT = 'connectives_revision_correct_count';
const CONNECTIVES_REVISION_IGNORE_COUNT = 'connectives_revision_ignore_count';
const FULLMARK_IGNORE_COUNT = 'full_mark_ignore_count';
const MATCH_FRENZY_SCOREBOARD_KEY = 'matching_frenzy_scoreboard';

const COLOR_TEXT = 'rgba(0,0,0,0.9)';
const GOOD_JOB_BG_COLOR = 'rgba (0,255,0,1)';
const WRONG_ANS_BG_COLOR = 'rgba (255,0,0,1)';
const HELLOWORLD = 'HELLOWORLD';

//
const GENIUS_STAGES = [10, 50, 100, 300, 700, 1000];
const HARDWORKER_STAGES = [5, 50, 100, 500, 1000, 1500, 3000];
const ATTENTIVE_EARS_STAGES = [1, 10, 50, 100, 300, 700, 1000];
const MATCHMAKING_STAGES = [30, 100, 250, 500, 1500, 3000, 8000];
const CONNECTIVE_CONQUEROR_STAGES = [1, 5, 15, 35, 60];

//
const THE_WORD_REMOVED = 'The word removed';
const THE_WORD_REMOVED_DISMISS_TIMEOUT = 1000;

const CORRECT_ANSWER_MESSAGE = 'Good job!';
const CORRECT_ANSWER_DISMISS_TIMEOUT = 3000;
//
const WRONG_ANSWER_MESSAGE = 'Wrong answer !';
const WRONG_ANSWER_DISMISS_TIMEOUT = 3000;

//
const PRESS_START_TO_BEGIN = 'Press start to begin';
const PRESS_START_TO_BEGIN_MESSAGE = 'Relax and Prepare yourself';

//
const CORRECTION_PHASE = 'correction phase';

//
const hide_setting = true;
const DEBUG = false;
const TEST = process.env.NODE_ENV === 'test';

//
const MY_FAVORITE = 'My Favorite';

//
if (!import.meta.env.VITE_POCKETBASE_URL) throw new Error(ERR_POCKETBASE_URL_IS_EMPTY);
const POCKETBASE_URL = import.meta.env.VITE_POCKETBASE_URL;
//
// database constants
export const COL_USERS = 'users';
export const COL_USER_METAS = 'UserMetas';
//
export const RUNNING_PLATFORM = Capacitor.getPlatform();

export {
  //
  API_URL,
  APP_USE_TIME,
  ATTENTIVE_EARS_STAGES,
  //
  COLOR_TEXT,
  CONNECTIVES_REVISION_CORRECT_COUNT,
  CONNECTIVES_REVISION_IGNORE_COUNT,
  CONNECTIVE_CONQUEROR_STAGES,
  CONNECTIVE_REVISION_LINK,
  //
  CORRECTION_PHASE,
  CORRECT_ANSWER_DISMISS_TIMEOUT,
  //
  CORRECT_ANSWER_MESSAGE,
  DEBUG,
  DEBUG_LINK,
  FAVORITE_LINK,
  //
  FULLMARK_COUNT_KEY,
  FULLMARK_IGNORE_COUNT,
  //
  GENIUS_STAGES,
  //
  GOOD_JOB_BG_COLOR,
  HARDWORKER_STAGES,
  //
  HELLOWORLD,
  HELLOWORLD_MP3,
  LESSON_LINK,
  LESSON_WORD_PAGE_LINK,
  LISTENING_PRACTICE_LINK,
  LISTENING_PRACTICE_TIME_SPENT,
  MATCHING_FRENZY_CORRECT_COUNT,
  MATCHING_FRENZY_LINK,
  MATCHMAKING_STAGES,
  MATCH_FRENZY_SCOREBOARD_KEY,
  MY_ACHIEVEMENT_LINK,
  //
  MY_FAVORITE,
  //
  PRESS_START_TO_BEGIN,
  PRESS_START_TO_BEGIN_MESSAGE,
  QUIZ_MAIN_MENU_LINK,
  RECORD_LINK,
  SETTING_LINK,
  TEST,
  //
  THE_WORD_REMOVED,
  THE_WORD_REMOVED_DISMISS_TIMEOUT,
  VERSIONS,
  WRONG_ANSWER_DISMISS_TIMEOUT,
  WRONG_ANSWER_MESSAGE,
  WRONG_ANS_BG_COLOR,
  //
  POCKETBASE_URL,
  //
  hide_setting,
};

export const DEFAULT_FORWARD_TIMEOUT = 3000;
