import { AppData } from "./AppData";
import { GameData } from "./GameData";
import { HttpData } from "./HttpData";
import { LoginData } from "./LoginData";
import { StorageData } from "./StorageData";
import { WechatData } from "./WechatData";
import { HelpData } from "./module/HelpData";
import { PigBankData } from "./module/PigBankData";
import { TurnableData } from "./module/TurnableData";
import { SignData } from "./module/SignData";
import { FissionData } from "./module/FissionData";
import { AdData } from "./AdData";
import { RewardData } from "./module/RewardData";
import { Data } from "../../mk/data/Data";
import { CashNormalData } from "./module/CashNormalData";
import { ReceiptNoticeData } from "./module/ReceiptNoticeData";
import { BlessingBagData } from "./module/BlessingBagData";
import CashProData from "./module/CashProData";
import { RedBagCashData } from "./module/RedBagCashData";
import RedCodeData from "./module/RedCodeData";
import RedeemData from "./module/RedeemData";
import { MoreGameData } from "./module/MoreGameData";
import { SettingData } from "./module/SettingData";
import { GuideData } from "./module/GuideData";

/**
 * 数据集合全局类
 * @description 所有数据都通过这个类创建，修改，删除
 * @author 邹勇
 */
class GData {
    constructor() {
        this.init();
    }

    public loginData: LoginData;
    public appData: AppData;
    public gameData: GameData;
    public wechatData: WechatData;
    public httpData: HttpData;
    public adData: AdData;
    public storageData: StorageData;
    public guideData:GuideData;

    //module
    /** 领取红包奖励 */
    public reward: RewardData;
    /** 帮助 */
    public help: HelpData;
    /** 转盘 */
    public turnable: TurnableData;
    /** 裂变数据 */
    public fission: FissionData;
    /** 存钱罐 */
    public pigbank: PigBankData;
    public sign: SignData;
    /** 到账通知 */
    public receiptNotice: ReceiptNoticeData;
    /** 红包提现 */
    public redBagCash: RedBagCashData;
    /** 红包提现（常规提现） */
    public cashNormal: CashNormalData;
    public setting: SettingData;
    /** 更多游戏 */
    public moreGame: MoreGameData;
    public blessingBag: BlessingBagData;
    public cashPro: CashProData;
    public redCodeData: RedCodeData;
    public redeem: RedeemData;

    public moduleData: Map<number, Data>;

    init() {
        this.appData = new AppData();
        this.loginData = new LoginData();
        this.gameData = new GameData();
        this.wechatData = new WechatData();
        this.httpData = new HttpData();
        this.adData = new AdData();
        this.storageData = new StorageData();
        this.guideData = new GuideData();

        this.reward = new RewardData();
        this.help = new HelpData();
        this.turnable = new TurnableData();
        this.fission = new FissionData();
        this.pigbank = new PigBankData();
        this.sign = new SignData();
        this.receiptNotice = new ReceiptNoticeData();
        this.redBagCash = new RedBagCashData();
        this.cashNormal = new CashNormalData();
        this.setting = new SettingData();
        this.moreGame = new MoreGameData();
        this.blessingBag = new BlessingBagData();
        this.cashPro = new CashProData();
        this.redCodeData = new RedCodeData();
        this.redeem = new RedeemData();

        this.moduleData = new Map<number, Data>();
        this.moduleData.set(Fun.moreGame, this.moreGame);
        this.moduleData.set(Fun.turnable, this.turnable);
        this.moduleData.set(Fun.fission, this.fission);
        this.moduleData.set(Fun.pigbank, this.pigbank);
        this.moduleData.set(Fun.blessingBag, this.blessingBag);
        this.moduleData.set(Fun.sign, this.sign);
        this.moduleData.set(Fun.cashNormal, this.cashNormal);
        this.moduleData.set(Fun.redBagCash, this.redBagCash);
        this.moduleData.set(Fun.redeem, this.redeem);
    }
}

/**
 * 提现模块的功能ID
 */
export enum Fun {
    moreGame = 1,   //互推
    turnable = 2,   //转盘
    fission = 3,    //裂变
    pigbank = 4,    //存钱罐
    blessingBag = 5,   //福袋
    sign = 6,       //签到
    cashNormal = 7, //常规提现
    redBagCash = 8, //红包提现
    redeem = 9,     //兑换码
}

declare global {
    const gData: GData;
}
window['gData'] = new GData();



