package com.nexstreaming.app.apis;

import android.util.Log;

import java.util.Arrays;
import java.util.List;

public enum NexAdsMetadata {
    CUSTOM_AD_URL(""),
    SINGLE_INLINE_LINEAR("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator="),
    SINGLE_SKIPPABLE_INLINE("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator="),
    SINGLE_REDIRECT_LINEAR("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirectlinear&correlator="),
    SINGLE_REDIRECT_ERROR("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirecterror&nofb=1&correlator="),
    SINGLE_REDIECT_BROKEN("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirecterror&correlator="),
    VMAP_PRE_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_ROLL_BUMPER("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonlybumper&cmsid=496&vid=short_onecue&correlator="),
    VMAP_POST_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpostonly&cmsid=496&vid=short_onecue&correlator="),
    VMAP_POST_ROLL_BUMPER("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpostonlybumper&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_POST_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_STD3_POST_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpod&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_OPTI3_POST_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostoptimizedpod&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_STD3_POST_ROLL_BUMPER("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpodbumper&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_OPTI3_POST_ROLL_BUMMER("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostoptimizedpodbumper&cmsid=496&vid=short_onecue&correlator="),
    VMAP_PRE_MID_STD5_EVERY10_POST_ROLL("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostlongpod&cmsid=496&vid=short_tencue&correlator=");


    private static final List<NexAdsMetadata> ADS_METADATA_LIST =
            Arrays.asList(
                    SINGLE_INLINE_LINEAR,
                    SINGLE_SKIPPABLE_INLINE,
                    SINGLE_REDIRECT_LINEAR,
                    SINGLE_REDIRECT_ERROR,
                    SINGLE_REDIECT_BROKEN,
                    VMAP_PRE_ROLL,
                    VMAP_PRE_ROLL_BUMPER,
                    VMAP_POST_ROLL,
                    VMAP_POST_ROLL_BUMPER,
                    VMAP_PRE_MID_POST_ROLL,
                    VMAP_PRE_MID_STD3_POST_ROLL,
                    VMAP_PRE_MID_OPTI3_POST_ROLL,
                    VMAP_PRE_MID_STD3_POST_ROLL_BUMPER,
                    VMAP_PRE_MID_OPTI3_POST_ROLL_BUMMER,
                    VMAP_PRE_MID_STD5_EVERY10_POST_ROLL
                    );

    /** The ad tag for the video **/
    public final String adTagUrl;
    private final static String LOG_TAG = "NexAdsMetadata";

    NexAdsMetadata(String adTagUrl) {
        this.adTagUrl = adTagUrl;
    }

    public static CharSequence[] getNameList() {
        CharSequence[] array = new CharSequence[ADS_METADATA_LIST.size()];
        for( int i = 0; i < array.length; i++ ) {
            array[i] = ADS_METADATA_LIST.get(i).name();
        }
        return array;
    }

    public static String getTagName(int adIndex){
        return ADS_METADATA_LIST.get(adIndex).name();
    }

    public static String getVASTUrl(int adIndex) {
        Log.e(LOG_TAG, "adTag : " + NexAdsMetadata.ADS_METADATA_LIST.get(adIndex).name());
        return NexAdsMetadata.ADS_METADATA_LIST.get(adIndex).adTagUrl;
    }
}

