
using BPASmartClient.Lebai;
using BPASmartClient.Model.单片机.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MORKIC
{
    internal enum GOODS_TYPE
    {
        NEITHER,
        COFFEE,
        ICECREAM,
    }

    internal enum BATCHING_CLASS
    {
        HOLDER,
        MAIN_MATERIAL,
    }

    internal class PolymerBatching
    {
        internal const string ICE_MAIN_BATCHIN1_LOC = "52";
        internal const string ICE_MAIN_BATCHIN2_LOC = "53";
        internal const string ICE_MAIN_BATCHIN3_LOC = "54";
        internal const string COFFEE_HOLDER_LOC = "30";
        internal const string ICE_HOLDER_LOC = "51";
        public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() {
            {"1", GOODS_TYPE.COFFEE},
            {"2", GOODS_TYPE.COFFEE},
            {"3", GOODS_TYPE.COFFEE},
            {"4", GOODS_TYPE.COFFEE},
            {"5", GOODS_TYPE.COFFEE},
            {"6", GOODS_TYPE.COFFEE},
            {"7", GOODS_TYPE.COFFEE},
            {"8", GOODS_TYPE.COFFEE},
            {"9", GOODS_TYPE.COFFEE},
            {"10",GOODS_TYPE.COFFEE},
            {"11",GOODS_TYPE.COFFEE},
            {"12",GOODS_TYPE.COFFEE},
            {"13",GOODS_TYPE.COFFEE},
            {"14",GOODS_TYPE.COFFEE},
            {"15",GOODS_TYPE.COFFEE},
            {"16",GOODS_TYPE.COFFEE},
            {"17",GOODS_TYPE.COFFEE},
            {"18",GOODS_TYPE.COFFEE},
            {"19",GOODS_TYPE.COFFEE},
            {"20",GOODS_TYPE.COFFEE},
            {"21",GOODS_TYPE.COFFEE},
            {"22",GOODS_TYPE.COFFEE},
            {"23",GOODS_TYPE.COFFEE},
            {"24",GOODS_TYPE.COFFEE},
            {"25",GOODS_TYPE.COFFEE},
            {"30",GOODS_TYPE.COFFEE},
            {"51",GOODS_TYPE.ICECREAM},
            {ICE_MAIN_BATCHIN1_LOC,GOODS_TYPE.ICECREAM},
            {ICE_MAIN_BATCHIN2_LOC,GOODS_TYPE.ICECREAM},
            {ICE_MAIN_BATCHIN3_LOC,GOODS_TYPE.ICECREAM},
        };

        public GOODS_TYPE GoodsType { get; set; }
        public BATCHING_CLASS BatchingClass { get; set; }
        private string loc;

        public string Loc
        {
            get { return loc; }
            set
            {
                loc = value;
                if (GOODS_TYPES.ContainsKey(loc))
                    GoodsType = GOODS_TYPES[loc];
                switch (loc)
                {
                    case COFFEE_HOLDER_LOC:
                    case ICE_HOLDER_LOC:
                        BatchingClass = BATCHING_CLASS.HOLDER;
                        break;
                    default:
                        BatchingClass = BATCHING_CLASS.MAIN_MATERIAL;
                        break;
                }
            }
        }

        internal static Dictionary<string, PolymerBatching> BuildAll()
        {
            Dictionary<string, PolymerBatching> temp = new Dictionary<string, PolymerBatching>();
            foreach (var item in GOODS_TYPES)
            {
                temp.Add(item.Key, new PolymerBatching() { Loc = item.Key });
            }
            return temp;
        }

        internal static IC_SE GetIceCreamSE(string loc, out int sence)
        {
            switch (loc)
            {
                case ICE_MAIN_BATCHIN1_LOC:
                    sence = LebaiRobot.SENCE_接1号冰淇淋;
                    return IC_SE.SE_1;

                case ICE_MAIN_BATCHIN2_LOC:
                    sence = LebaiRobot.SENCE_接2号冰淇淋;
                    return IC_SE.SE_2;

                case ICE_MAIN_BATCHIN3_LOC:
                    sence = LebaiRobot.SENCE_接3号冰淇淋;
                    return IC_SE.SE_3;

                default:
                    sence = LebaiRobot.SENCE_接1号冰淇淋;
                    return IC_SE.SE_1;
            }
        }
    }
}
