package com.phlx.anchorcollect;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;

import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.FrozenSemenEntity;
import com.phlx.anchorcollect.entity.GenTableColumn;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import me.goldze.mvvmhabit.utils.SPUtils;


/**
 * <pre>
 *     author : lei
 *     e-mail : 18600395998@163.com
 *     time   : 2020/04/27
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class Configs {


    /**
     * 下载apk地址
     */
    public static String downloadApk = "/api/download?type=iPad";

    /**
     * 是否在线操作
     */
    public static boolean isOnLine = false;
    /**
     * 是否后缀端口
     */
    public static boolean isAddPort = true;
    /**
     * 是否https
     */
    public static boolean isHttps = true;

    //ip port
    public static final String SP_APP_IP = "sp_app_ip";
    public static final String SP_APP_PORT = "sp_app_port";
    //用户信息
    public static final String SP_USER_NAME = "sp_user_name";
    public static final String SP_ID = "sp_id";
    public static final String SP_ROLE_ID = "sp_role_id";
    public static final String SP_NAME = "sp_name";
    public static final String SP_LOGIN_NAME = "sp_login_name";
    public static final String SP_DEPT_ID = "sp_dept_id";
    public static final String SP_DEPT_NAME = "sp_dept_name";
    public static final String SP_FREQUENCY = "sp_frequency";
    public static final String SP_USER_PASSWORD = "sp_user_password";
    public static final String SP_USER_EMAIL = "sp_user_email";
    public static final String SP_FREQUENCY_CONFIG = "sp_frequency_config";

    //版本号
    public static final String SP_VERSION_NAME = "sp_version_name";

    //意见反馈首页提示数量
    public static final String SP_FEEDBACK_COUNT = "sp_feedback_count";

    public static final String SP_USER_PHONE = "sp_user_phone";
    public static final String SP_USER_UNIT = "sp_user_unit";
    //选择养殖场
    public static final String SP_UNIT_NAME = "sp_unit_unit";
    public static final String SP_UNIT_CODE = "sp_unit_code";
    public static final String SP_UNIT_PHONE = "sp_unit_phone";
    public static final String SP_UNIT_ID_CARD = "sp_unit_id_card";
    public static final String SP_UNIT_VILLAGE_NAME = "sp_unit_villag_name";
    public static final String SP_UNIT_REVISION = "sp_unit_revision";

    //type 加载fragment类型
    public static final String BASE_ARCHIVES = "base_archives";
    public static final String SIGN_MEASURE = "sign_measure";
    public static final String WEIGHTING_MANAGE = "weighting_manage";
    public static final String TREATMENT_RECORD = "treatment_record";
    public static final String IMMUN_RECORD = "immun_record";
    public static final String BREEDING_RECORD = "breeding_record";
    public static final String BREEDING_RECORD_DETAIL = "breeding_record_detail";

    //最后更新的时间
    public static final String SP_CATTLE_RESUME_UPDATE_DATE = "sp_cattle_resume_update_date";
    public static final String SP_PERFORMANCE_UPDATE_DATE = "sp_performance_update_date";
    public static final String SP_WEIGHT_MAN_UPDATE_DATE = "sp_weight_man_update_date";
    public static final String SP_MEDICAL_RECORD_UPDATE_DATE = "sp_medical_record_update_date";
    public static final String SP_IMMUNE_BATCH_UPDATE_DATE = "sp_immune_batch_update_date";
    public static final String SP_IMMUNE_BATCH_DETAIL_UPDATE_DATE = "sp_immune_batch_detail_update_date";
    public static final String SP_BREEDING_RECORD_UPDATE_DATE = "sp_breeding_record_update_date";
    public static final String SP_BREEDING_RECORD_DETAIL_UPDATE_DATE = "sp_breeding_record_detail_update_date";

    //盘点类型
    public static final String SP_INVENTORY_STATUS = "SP_inventory_status";

    //上电类型
    public static final String SP_POWER_ON_TYPE = "sp_power_on_type";
    //模块类型
    public static final String SP_MODULE_TYPE = "sp_module_type";


    //0 高频，1低频
    public static String FREQUENCY_CONFIG = "1";

    //是否是普通盘点模式,，true普通  多次，false返回最多数量标签模式   一次
    public static boolean inventoryStatus;

    /** 蓝牙 */
    public static boolean isConnected = false;// 蓝牙连接状态
    public static final String DEVICEADDRESS = "deviceAddress";
    public static String DEVICENAME = "deviceName";

    //外挂字体
    public static Typeface typeface;

    //页面结构
    public static List<GenTableColumn> cattleresume;
    public static List<GenTableColumn> performance;
    public static List<GenTableColumn> weightMan;
    public static List<GenTableColumn> medicalrecords;
    public static List<GenTableColumn> immunebatch;
    public static List<GenTableColumn> cattlematingMaster;
    public static List<GenTableColumn> cattlematingMasterList;
    public static List<GenTableColumn> cattlematingDetaill;
    public static List<GenTableColumn> cattlematingDetaillList;

    //字典项
    public static List<DictEntity> dictList = new ArrayList<>();

    public static List<FrozenSemenEntity> frozenSemenList = new ArrayList<>();

    //临时存放列表查询可视耳标
    public static String tempTag = "";
    //临时存放列表查询电子耳标
    public static String tempRfid = "";
    //临时存放列表查询unid
    public static Long tempUnid;
    //临时存放耳标数据
    public static CattleResumeEntity tempCattleResume;
    //临时存放重量数据
    public static Double tempWeight= 0.0;

    //首页fragment标签
    public static int mainPosition;
    public static Long resumeId;

    public static String currentEvent;//控制接受重量数据的页面

    public static String cpuName = "";

    public static String raiseVarieties = "";
    public static String deptName = "";



//    public static boolean ISCONNECTED;

    public static String packageName(Context context) {
        PackageManager manager = context.getPackageManager();
        String name = null;
        try {
            PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
            name = info.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return name;
    }
}
