import { _decorator } from 'cc';
const { ccclass } = _decorator;

/** 玩家数据类 */
@ccclass('ChannelData')
class ChannelData {
    public static instance: ChannelData | null = null;

    /** 获取渠道数据状态 */
    public get_success: boolean = false;

    /** 活动开关(0:关闭,1:开启) */
    public activity_open : number = 0;
    /** 币商功能(0:禁用,1:启用) */
    public coin_status : boolean = true;
    /** 币别代码 */
    public currency : string = "";
    /** 讨论组功能(0:禁用,1:启用) */
    public discussion_group_status : boolean = true;
    /** 渠道域名 */
    public domain : string = "";
    /** 下载地址 */
    public download_url : string = "";
    /** 渠道ID */
    public id : number = 0;
    /** 语言     */
    public lang : string = "";
    /** line client id */
    public line_client_id : string = "";
    /** line 登录功能(0:禁用,1:启用) */
    public line_login_status : boolean = true;
    /** 机台线路 */
    public machine_media_line : number = 0;
    /** 渠道名称 */
    public name : string = "";
    /** 全民代理功能(0:禁用,1:启用) */
    public national_promoter_status : boolean = true;
    /** 代理开启状态 */
    public promotion_status : boolean = true;
    /** Q币转入(0:禁用,1:启用) */
    public q_talk_point_status : boolean = true;
    /** Q币充值(0:禁用,1:启用) */
    public q_talk_recharge_status : boolean = true;
    /** Q币转出(0:禁用,1:启用) */
    public q_talk_withdraw_status : boolean = true;
    /** 排行榜功能(0:禁用,1:启用) */
    public ranking_status : boolean = true;
    /** 充值开启状态 */
    public recharge_status : boolean = true;
    /** 反水开启状态 */
    public reverse_water_status : boolean = true;
    /** 实体机台开关 0关闭1-开启 */
    public status_machine : boolean = true;
    /** web登录状态(0:禁用,1:启用) */
    public web_login_status : boolean = true;
    /** 人工提现(0:禁用,1:启用) */
    public withdraw_status : boolean = true;

    private constructor(){}
    static get Instance(){
        if(ChannelData.instance == null){
            ChannelData.instance = new ChannelData();
        }
        return ChannelData.instance;
    }

    public setChannelData(data:any){
        for (let key in data){
            if (this.hasOwnProperty(key)){
                (this as any)[key] = data[key];
            }
        }

        this.get_success = true;
    }
}

/**
 * 游戏配置数据
 */
export const CHANNELDATA = ChannelData.Instance;