// this savestate holds everything, a user can set and expects to get stored
// it will be saved in local storage and when present, loaded

export const MUTE_ALL = "MUTE_ALL";
export const TOGGLE_MUSIC = "TOGGLE_MUSIC";
export const TOGGLE_SOUNDS = "TOGGLE_SOUNDS";
export const TOGGLE_SHOW_TIPS = "TOGGLE_SHOW_TIPS";
export const SET_LEVEL_DONE = "SET_LEVEL_DONE";
export const SAVESTATE = "SaveState";

export interface SaveState {
    levels: Array<LevelSaveState>,
    playSounds: boolean,
    playMusic: boolean,
    showTips: boolean
}

export interface LevelSaveState {
    stars: number,
    done: boolean
}

export interface muteAllAction {
    type: typeof MUTE_ALL
}

export interface toggleSoundsAction {
    type: typeof TOGGLE_SOUNDS
}

export interface toggleMusicAction {
    type: typeof TOGGLE_MUSIC
}

export interface toggleShowTipsAction {
    type: typeof TOGGLE_SHOW_TIPS
}

export interface setLevelDoneAction {
    type: typeof SET_LEVEL_DONE,
    levelIdx: number,
    stars: number
}

export type SaveStateActions =
    muteAllAction
    | toggleMusicAction
    | toggleSoundsAction
    | setLevelDoneAction
    | toggleShowTipsAction
