using Ping9719.WpfEx.Mvvm;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.StoreInfo;
using 智能仓储WCS管理系统.Tool;

namespace 智能仓储WCS管理系统.ViewModel
{
    public class ShelfInfoAddOrUpdateViewModel : BindableBase
    {
        #region Property 属性
        public ShelfInfoAddOrUpdateViewModel()
        {
            ShelfTypeItems = GetBaseData.GetShelfType();
            if (ShelfTypeItems != null && ShelfTypeItems.Count > 0)
                SelectedShelfTypeItem = ShelfTypeItems.First();
        }

        public void SetValues(ShelfInfoModel shelfInfoModel)
        {
            if (shelfInfoModel != null)
            {
                ShelfId = shelfInfoModel.Id;
                SelectedShelfTypeItem = shelfTypeItems.First(t => t.Id == shelfInfoModel.ShelfTypeId);
                ShelfCode = shelfInfoModel.ShelfCode;
                RowCounts = shelfInfoModel.Rowcounts;
                ColumnCounts = shelfInfoModel.Columncounts;
                LightId = shelfInfoModel.LightId;
                ClientIp = shelfInfoModel.ClientIp;
                GroupName = shelfInfoModel.GroupName;
                IsBind = shelfInfoModel.IsBind;
                BigShelfCode = shelfInfoModel.BigShelfCode;
            }
        }

        public ShelfInfoModel GetValues()
        {
            return new ShelfInfoModel()
            {
                Id = ShelfId,
                ShelfTypeId = SelectedShelfTypeItem.Id,
                ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName,
                ShelfCode = ShelfCode,
                Rowcounts = RowCounts,
                Columncounts = ColumnCounts,
                LightId = LightId,
                ClientIp = ClientIp,
                GroupName = GroupName,
                IsBind = IsBind,
                BigShelfCode = BigShelfCode,
            };
        }

        private int shelfId;
        public int ShelfId
        {
            get { return shelfId; }
            set
            {
                SetProperty(ref shelfId, value);
            }
        }


        private List<ShelfTypeModel> shelfTypeItems;
        public List<ShelfTypeModel> ShelfTypeItems
        {
            get { return shelfTypeItems; }
            set
            {
                SetProperty(ref shelfTypeItems, value);
            }
        }

        private ShelfTypeModel selectedShelfTypeItem;
        public ShelfTypeModel SelectedShelfTypeItem
        {
            get { return selectedShelfTypeItem; }
            set
            {
                SetProperty(ref selectedShelfTypeItem, value);
            }
        }

        private string shelfCode;
        public string ShelfCode
        {
            get { return shelfCode; }
            set
            {
                SetProperty(ref shelfCode, value);
            }
        }

        private int rowCounts;
        public int RowCounts
        {
            get { return rowCounts; }
            set
            {
                SetProperty(ref rowCounts, value);
            }
        }

        private int columnCounts;
        public int ColumnCounts
        {
            get { return columnCounts; }
            set
            {
                SetProperty(ref columnCounts, value);
            }
        }

        private int lightId;
        public int LightId
        {
            get { return lightId; }
            set
            {
                SetProperty(ref lightId, value);
            }
        }

        private string clientIp;
        public string ClientIp
        {
            get { return clientIp; }
            set
            {
                SetProperty(ref clientIp, value);
            }
        }

        private string groupName;
        public string GroupName
        {
            get { return groupName; }
            set
            {
                SetProperty(ref groupName, value);
            }
        }

        private bool isBind;
        public bool IsBind
        {
            get { return isBind; }
            set
            {
                SetProperty(ref isBind, value);
            }
        }

        private string bigShelfCode;
        public string BigShelfCode
        {
            get { return bigShelfCode; }
            set
            {
                SetProperty(ref bigShelfCode, value);
            }
        }
        #endregion
    }
}
