/**
 * @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 watchVideo(type: AdFun) {
        this.ad_subType = type;
        let data = {
            "imei": gData.appData.machineInfo.imei,
            "idfa": gData.appData.machineInfo.idfa,
            "oaid": gData.appData.machineInfo.oaid,
            "uin": gData.loginData.uin,
            "version": gData.appData.appVersion,
            "tf_channel": gData.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;
        }
        switch(this.ad_subType){
            case AdFun.bubble:

            break;
            case AdFun.sign
        }
        this.data = response.data;
    }

}
