using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels;
using WCS.Model;
using static WCS.BLL.HardWare.WarningLight;

namespace WCS.BLL.HardWare
{
    /// <summary>
    /// 货架基类
    /// </summary>
    public interface IShelfBase
    {
        /// <summary>
        /// 货架是否处于报警中
        /// </summary>
        public bool IsWarning { get; set; }
        /// <summary>
        /// 货架ID 数据库中那个
        /// </summary>
        public int ShelfId { get; set; }

        /// <summary>
        /// 货架编码
        /// </summary>
        public string ShelfCode { get; set; }

        /// <summary>
        /// 货架模组行数
        /// </summary>
        public int RowCounts { get; set; }

        /// <summary>
        /// 货架模组列数
        /// </summary>
        public int ColumnCounts { get; set; }

        public int LightId { get; set; }
        public LightColorEnum LightColor { get; set; }
        public List<int> ModuleIds { get; set; }
        public List<SmartShelfModule> Modules { get; set; }
        public string ClientIp { get; set; }
        /// <summary>
        /// 货架当前模式
        /// </summary>
        public Mode CurrentMode { get; set; }
        /// <summary>
        /// 设置到当前模式的时间
        /// </summary>
        public DateTime SetCurrentModeTime { get; set; }

        public MatInfoResponse InStoreData { get; set; }

        public List<string> ExceptionMessages { get; set; }

        public string OrderNumber { get; set; }//出库/盘点模式中的单据号

        public string ModulesStr { get; set; }

        /// <summary>
        /// 货架组别
        /// </summary>
        public string GroupName { get; set; }

        public string WebSocketIpAddress { get; set; }

        public string? CurrentCom { get; set; } 
        /// <summary>
        /// 模组
        /// </summary>
        //public List<IModuleBase> Modules { get; set; }

        /// <summary>
        /// 设置货架模式
        /// </summary>
        public void SetCurrentMode(Mode mode);

        /// <summary>
        /// 货架进入入库模式
        /// </summary>
        public void GoInInstore(string? IPAdress);

        /// <summary>
        /// 货架退出入库模式
        /// </summary>
        public void GoOutInstore();

        /// <summary>
        /// 货架进入出库模式
        /// </summary>
        public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder,string OperateUser);

        /// <summary>
        /// 货架退出出库模式
        /// </summary>
        public void GoOutOutstore();

        /// <summary>
        /// 货架进入盘点模式
        /// </summary>
        public void GoInStocktaking(List<StockTakingOrderMatDetail> MatDetails, StockTakingOrder outOrder);


        /// <summary>
        /// 货架单个确认盘点
        /// </summary>
        public bool ConfirmStocktakingSingle(int BoardId, int LightNumber);

        /// <summary>
        /// 货架退出盘点模式
        /// </summary>
        public void GoOutStocktaking();

        /// <summary>
        /// 货架报警
        /// </summary>
        public void Warning();

        /// <summary>
        /// 货架复位
        /// </summary>
        public void Reset();

        /// <summary>
        /// 货架自检
        /// </summary>
        public void ShelfCheck();
    }

    public enum Mode
    {
        待机模式 = 0,
        入库模式 = 1,
        出库模式 = 2,
        盘点模式 = 3
    }
}
