/**
 * @description 广告数据
 * @author 邹勇
 */
export class AdData {

    public placementId = '';
    public adunit_format = '';
    public network_type = '';
    public network_placement_id = '';
    public network_firm_id = '';
    public adsource_id = '';
    public adsource_index = '';
    public adsource_price = '';
    public adsource_isheaderbidding = '';
    public publisher_revenue = '';
    public precision = '';
    public ecpm_level = '';

    /** 广告类型（1:激励视频、2:插屏、3:信息流） */
    public adType: number = 1;

    /** 视频类型 */
    public ad_subType: AdFun;

    /** 看视频后回复的数据 每个功能回复的内容不一样，具体看接口文档 */
    public data: any;


    public init() {

    }


    public async updateVideo(type: AdFun) {
        this.ad_subType = type;
        let data = {
            "imei": g.appData.machineInfo.imei,
            "idfa": g.appData.machineInfo.idfa,
            "oaid": g.appData.machineInfo.oaid,
            "uin": g.loginData.uin,
            "version": g.appData.appVersion,
            "tf_channel": g.appData.tfChannel,
            "destoon_ad_place": this.placementId,
            "adunit_format": this.adunit_format,
            "network_type": this.network_type,
            "network_placement_id": this.network_placement_id,
            "network_firm_id": this.network_firm_id,
            "adsource_id": this.adsource_id,
            "adsource_index": this.adsource_index,
            "adsource_price": this.adsource_price,
            "adsource_isheaderbidding": this.adsource_isheaderbidding,
            "publisher_revenue": this.publisher_revenue,
            "precision": this.precision,
            "ecpm_level": this.ecpm_level,
            "ad_sbuType": this.ad_subType,
            "ad_type": 1,
        }
        let response = await mk.http.sendData('updateVideo', data);
        if (response.errcode != 0) {
            return;
        }
        this.data = response.data;
    }

}

/**
 * 看视频类型
 */
export enum AdFun {
    bubble = 1,         //气泡视频
    checkpoint = 2,     //关卡视频
    settlement = 3,     //关卡结算视频
    turntable = 4,      //转盘视频
    sign = 5,           //签到视频
    bigCash = 6,         //福袋视频
}