package com.sheep.gamegroup.util;


import com.sheep.jiuyan.samllsheep.BuildConfig;
import com.sheep.jiuyan.samllsheep.SheepApp;


/**
 * Created by ljy on 2018/3/15.
 */

public enum ConnectAddress {
    dangyongfeng {

        @Override
        public String getAppUrl() {
            return "http://10.8.220.237:8010/";
        }
        @Override
        public String getName() {
            return "党勇锋";
        }
    },
    ruanlang {

        @Override
        public String getAppUrl() {
//            return "http://10.8.240.156:8080/";
            return "http://10.8.220.249:8080/";
        }
        @Override
        public String getName() {
            return "阮浪";
        }
    },
    sheepxiexing {

        @Override
        public String getAppUrl() {
            return "http://10.8.220.239:8080/";
//            return "http://10.8.220.245:8080/";
//            return "http://10.8.220.229:8080/";
        }
        @Override
        public String getName() {
            return "谢兴";
        }
    },sheepmeien {

        @Override
        public String getAppUrl() {
//            return "http://10.8.210.229:8080/";
//            return "http://10.8.210.243:8080/";
            return "http://10.8.210.235:8080/";
        }
        @Override
        public String getName() {
            return "梅恩";
        }
    },developSheeptest {

        @Override
        public String getAppUrl() {
            return "http://test.sheep.kfzs.com/";
        }
        @Override
        public String getName() {
            return "开发测试服";
        }
    },sheeptest {

        @Override
        public String getAppUrl() {
            return "http://testnei.ss.kfzs.com/";
        }
        @Override
        public String getName() {
            return "黄海测试服";
        }
    },sheepfz {

        @Override
        public String getAppUrl() {
            return "http://simul.ss.kfzs.com/";
        }

        @Override
        public String getName() {
            return "正式服仿真";
        }
    },sheep {

        @Override
        public String getAppUrl() {
            return "http://ss.kfzs.com/";
        }

        @Override
        public String getName() {
            return "正式服";
        }

    };
    public abstract String getAppUrl();

    public abstract String getName();

    @Override
    public String toString() {
        return getName();
    }

    public int getPlatForm() {
        return getName().endsWith("IOS") ? 0 : 1;//0 ios, 1 android
    }
    public boolean isUseUMStatistics(){//只有正式服不使用友盟统计
        return !getName().equals("sheep");
    }
    public boolean isThisService(){
        return !BuildConfig.DEBUG || SheepApp.getInstance().getConnectAddress() == this;
    }
    public String getWorldCupUrl(){
        return "http://10.8.210.172:8080/#/";
    }

    public int getVersionType() {
        switch (this){
            case sheep:
                return 1;
            default:
                return 0;
        }
    }
    public String getPackageName() {
        switch (this){
            default:
                return "com.sheep.jiuyan.samllsheep";
        }
    }

    public ConnectAddress getDefaultConnectAddress() {
        if(TestUtil.isTest()){
            if(ConfigUtil.getInstance().isFileExists()) {
                String flavor = ConfigUtil.getInstance().getItem(0);//第一行填写connectAddress的名字
                try {
                    return ConnectAddress.valueOf(flavor);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        String flavor = TestUtil.isSheep() ? "sheep" : DataUtil.getAsString("flavor", BuildConfig.FLAVOR);
        try {
            return ConnectAddress.valueOf(flavor);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return this;
    }
}
