using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;

namespace BBWY.Client.Models.SealBox
{

    /// <summary>
    /// 待配置
    /// </summary>
    public class SealBoxConfigureModel : NotifyObject
    {
        /// <summary>
        /// skuid
        /// </summary>
        public string SkuId { get; set; }

        /// <summary>
        /// sku标题
        /// </summary>
        public string SkuName { get; set; }
        /// <summary>
        /// 任务id
        /// </summary>
        public long TaskId { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        private TaskState? taskState;
        /// <summary>
        /// 任务状态
        /// </summary>
        public TaskState? TaskState { get => taskState; set { Set(ref taskState, value); } }


        private int skuCount;
        /// <summary>
        /// sku任务数
        /// </summary>
        public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } }


        private int waitConfigureCount;
        /// <summary>
        /// 待分配数量
        /// </summary>
        public int WaitConfigureCount
        {
            get
            {
                return waitConfigureCount;
            }
            set { Set(ref waitConfigureCount, value); }
        }

        /// <summary>
        /// sku图片
        /// </summary>
        public string Logo { get; set; }


        private ObservableCollection<SealBoxConfigureWareHourseModel> wareHourseDatas = new ObservableCollection<SealBoxConfigureWareHourseModel>();
        /// <summary>
        /// 装箱配置列表
        /// </summary>
        public ObservableCollection<SealBoxConfigureWareHourseModel> WareHourseDatas { get => wareHourseDatas; set { Set(ref wareHourseDatas, value); } }


        private WareType? wareType;

        public WareType? WareType { get => wareType; set { Set(ref wareType, value); } }
    }






    /// <summary>
    /// 封箱配置 装箱配置
    /// </summary>
    public class SealBoxConfigureWareHourseModel : NotifyObject
    {
        public long TaskId { get; set; }

        public Action<int, long> TotalWareCount { get; set; }

        private int count;

        public int Count
        {
            get => count; set
            {
                Set(ref count, value);
                OnCountChanged();
            }
        }

        private void OnCountChanged()
        {

            if (Count<0)
            {
                MessageBox.Show("数量不能为负数");
                return;
            }

            if (TotalWareCount != null) TotalWareCount(Count, TaskId);
        }

        private string wareId;

        public string WareId { get => wareId; set { Set(ref wareId, value); } }


        private string wareName;

        public string WareName { get => wareName; set { Set(ref wareName, value); } }



        private PositionState? wareState;
        /// <summary>
        ///待封箱 = 0, 待落仓 = 1, 待落仓已配置 = 2,待完结=3
        /// </summary>
        public PositionState? WareState { get => wareState; set { Set(ref wareState, value); } }

        /// <summary>
        ///封箱id
        /// </summary>
        public long? SealBoxId { get; set; }

        //private WareType? wareType;

        //public WareType? WareType { get => wareType; set { Set(ref wareType, value); } }

    }
}