import { CurrencyMeta, Money, Paytable } from '../../types/api';
import { buildBootstrap } from './buildBootstrap';

type Snapshot = {
    balance: number;
    currency: CurrencyMeta;
    modes: any[];
    featureMultipliers: { bonusBuy: number; freespinBuy: number; bonusChance: number };
    paytableData: Paytable;
    baseBet: Money;
    machineConfig: any;
};

export default class ModelDataInitializer
{
    private readonly snap: Snapshot;

    constructor(rawData: any, machineConfig: any, bootstrap = buildBootstrap())
    {
        this.snap = bootstrap.init(rawData, machineConfig);
    }

    get balance() { return this.snap.balance; }
    get currency() { return this.snap.currency; }
    get modes() { return this.snap.modes; }
    get featureMultipliers() { return this.snap.featureMultipliers; }
    get paytableData() { return this.snap.paytableData; }
    get baseBet() { return this.snap.baseBet; }
    get machineConfig() { return this.snap.machineConfig; }

    toSnapshot(): Snapshot
    {
        return this.snap;
    }
}
