package com.example.bpa.config;

import android.content.Context;
import android.graphics.Region;

import com.example.bpa.Model.Res_PLCADDRESS;
import com.example.bpa.db.mode.BPA_USER;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 配置文件
 */
public class ConfigName {
    //region 单例模式
    private static ConfigName  mInstance; //实例变量设置私有，防止直接通过类名访问

    private ConfigName() { //默认构造函数私有，防止类外直接new创建对象
    }

    public static synchronized ConfigName getInstance() { //静态同步方法作为唯一的实例对象获取方式
        if (mInstance==null) {
            mInstance = new ConfigName();
        }
        return mInstance;
    }
    //endregion

    //region 程序进入界面
    public Context dishesCon;
    public Context Home;
    //endregion

    //region SD卡路径设置
    /**
     * SD卡路径
     */
    public String sdCardPath;
    /**
     * 应用程序 Res 根路径
     */
    public String appResRoot;
    /**
     * Db文件路径
     */
    public static String dbPath = "";
    //endregion

    //region 店铺配置
    /**
     * 店铺名称
     */
    public String  Shop_Name="黑菠萝奶茶机";
    /**
     * 店铺设备号
     */
    public String AutKey="152.146";
    public String ClientId="152";
    public String DevId="146";
    /**
     * 店铺设备号
     */
    public String DeviceId="20020415-test";
    //endregion

    //region MQTT配置中心
    /**
     * 用户名
     */
    public String mqtt_userName="emqx_u_block";
    /**
     * 密码
     */
    public String mqtt_passWord="emqx_p_admin8765490789";
    /**
     * ip地址
     */
    public String mqtt_ip="10.2.1.21";
    /**
     * post端口
     */
    public int mqtt_post=1883;
    /**
     * 订阅主题
     */
    public String mqtt_topic="DOWN/MORKT/BUSINESS/";
    public String mqtt_hearttopic="UP/MORKT/HEARTBEAT";
    //endregion

    //region 环境配置
    /**
     * 环境配置
     */
    public String Environment="开发环境";
    //endregion

    //region 登录信息
    /**
     * 用户信息
     */
    public BPA_USER user=new BPA_USER();
    //endregion

    //region 版本信息
    /**
     * 版本更新
     */
    public String Version="1.0";
    //endregion

    //region 是否手动下单
    /**
     * 是否手动下单
     */
    public Boolean IsUserDownOrder=true;
    //endregion

    //region 是否自动加热
    /**
     * 是否自动加热
     */
    public Boolean AutomaticHeating=false;
    //endregion

    //region 系统设置表
    /**
     * 订单上报周期，默认一小时 *60
     */
    public int OrderPushTime=3600;
    /**
     * 料仓余量上报周期，默认10分钟 *60
     */
    public int SilosValuePushTime=600;
    /**
     * 其他传感器上报周期，默认10分钟 *60
     */
    public int OtherValuePushTime=600;
    /**
     * 管道排空周期，默认一小时 *60
     */
    public int PipeDrainCycleTime=3600;
    /**
     * 订单未制作超时规则，默认20分钟 *60
     */
    public int OrderTimeout=1200;
    /**
     * 料仓补料阈值，500g
     */
    public int SiloFeedThreshold=500;
    /**
     * 料仓告警阈值，50g
     */
    public int SiloAlarmThreshold=50;
    /**
     * 自动清洗时间，默认一小时 *60
     */
    public int AICleanTime=3600;
    //endregion

    //region PlC连接参数
    /**
     * Plc地址
     */
    public String Address="192.168.1.100";
    /**
     * Plc端口
     */
    public int Post=502;
    //endregion

    /**
     * 是否单杯制作
     */
    public  boolean IsSingleCupMake=true;
    /**
     * 是否测试
     */
    public  boolean IsTest=true;
    //region URL
    //Sass地址
    public String SaasAddress="http://order.test1.com";
    //public String SaasAddress="https://bpa.black-pa.com:21527";
    //public String SaasAddress="https://witt.black-pa.com";

    //获取订单详情接口 Get
    public String GetOrder="order/order/fullorderbynumber/";
    //POST
    public String OrderChange="order/order/robotstatuschange";

    public String UpdateVersion="http://111.9.47.105:18097/api/Version/GetLatest";
    //endregion

    /**
     * 大炒基础PLC模型
     */
    public List<Res_PLCADDRESS> PlcAddress_配料吧_手动=new ArrayList<Res_PLCADDRESS>(){{

        //硬件设备 初始化
        add(new Res_PLCADDRESS("-------------","","出料口",1,0));
        add(new Res_PLCADDRESS("M51.6","M101.6","出料口振动器",1,1));

        add(new Res_PLCADDRESS("-------------","","酱油仓/猪油仓",1,0));
        add(new Res_PLCADDRESS("M52.7","M102.7","酱油仓控制",0,1));
        add(new Res_PLCADDRESS("M53.0","M103.0","猪油仓控制",0,1));
        add(new Res_PLCADDRESS("M51.7","M101.7","猪油仓加热",1,1));
        add(new Res_PLCADDRESS("M52.1","M102.1","猪油管道保温",1,1));


        add(new Res_PLCADDRESS("-------------","","外置仓",1,0));
        add(new Res_PLCADDRESS("M50.0","M100.0","外置仓控制(1)",0,1));
        add(new Res_PLCADDRESS("M50.1","M100.1","外置仓控制(2)",0,1));
        add(new Res_PLCADDRESS("M50.2","M100.2","外置仓控制(3)",0,1));
        add(new Res_PLCADDRESS("M50.3","M100.3","外置仓控制(4)",0,1));
        add(new Res_PLCADDRESS("M50.4","M100.4","外置仓控制(5)",0,1));
        add(new Res_PLCADDRESS("M50.5","M100.5","外置仓控制(6)",0,1));

        add(new Res_PLCADDRESS("M51.0","M101.0","外置仓搅拌(1)",1,1));
        add(new Res_PLCADDRESS("M51.1","M101.1","外置仓搅拌(2)",1,1));
        add(new Res_PLCADDRESS("M51.2","M101.2","外置仓搅拌(3)",1,1));
        add(new Res_PLCADDRESS("M51.3","M101.3","外置仓搅拌(4)",1,1));
        add(new Res_PLCADDRESS("M51.4","M101.4","外置仓搅拌(5)",1,1));
        add(new Res_PLCADDRESS("M51.5","M101.5","外置仓搅拌(6)",1,1));

        add(new Res_PLCADDRESS("-------------","","粉料仓",0,0));
        add(new Res_PLCADDRESS("M52.2","M102.2","粉料仓控制(1)",0,1));
        add(new Res_PLCADDRESS("M52.3","M102.3","粉料仓控制(1)",0,1));
        add(new Res_PLCADDRESS("M52.4","M102.4","粉料仓控制(1)",0,1));
        add(new Res_PLCADDRESS("M52.5","M102.5","粉料仓控制(1)",0,1));

        add(new Res_PLCADDRESS("-------------","","水池",1,0));
        add(new Res_PLCADDRESS("M50.6","M100.6","水池排水阀",1,1));
        add(new Res_PLCADDRESS("M52.6","M102.6","水池进水阀",1,1));
        add(new Res_PLCADDRESS("M52.0","M102.0","水池加热",1,1));


        add(new Res_PLCADDRESS("-------------","","外部水箱",1,0));
        add(new Res_PLCADDRESS("M50.7","M100.7","水箱排水阀",1,1));
        add(new Res_PLCADDRESS("M53.1","M103.1","水箱加热",1,1));
        add(new Res_PLCADDRESS("M53.2","M103.2","水箱水泵",1,1));
        add(new Res_PLCADDRESS("M53.3","M103.3","外部管道加热",1,1));
    }};
}
