import type { BonusIndicatorData, SlotModel } from './types';

/** View model exposing runtime flags for the gameplay layer. */
export default class GameplayViewModel
{
    private readonly model: SlotModel;

    constructor(model: SlotModel)
    {
        this.model = model;
    }

    get lines(): unknown
    {
        return this.model.currentMode.lines;
    }

    get currency()
    {
        return this.model.currency;
    }

    get isRoundStarted(): boolean
    {
        return this.model.currentMode.isRoundStarted();
    }

    get isRoundEndProcessing(): boolean
    {
        return this.model.isRoundEndProcessing;
    }

    get isRoundEnded(): boolean
    {
        return !this.model.currentMode.isRoundStarted();
    }

    set isRoundEnded(value: boolean)
    {
        if (!value) return;
        this.model.performEndRound();
    }

    get isTurboModeActive(): boolean
    {
        return this.model.turboMode;
    }

    get isFastStopActive(): boolean
    {
        return this.model.isFastStopActive();
    }

    get isTurboModeForced(): boolean
    {
        return this.model.isTurboModeForced();
    }

    get isSkipAnimation(): boolean
    {
        return this.model.isSkipAnimation;
    }

    get isBigWinAchieved(): boolean
    {
        return this.model.isBigWinAchieved();
    }

    get gameData(): unknown
    {
        return this.model.currentMode.gameData;
    }

    get bonusIndicatorData(): BonusIndicatorData
    {
        return this.model.currentMode.bonusIndicatorData;
    }

    set win(value: number)
    {
        this.model.addWinAmount(value);
    }

    get win(): number | null
    {
        return this.model.win;
    }
}
