using Pms.DataLibrary.Models;
using Pms.DataLibrary.Order;
using Pms.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManagementSystem.Common.Extenions
{
    public static class ModelExtenions
    {
        public static StepData GetCurrentStepInfo(this TaskData taskData)
        {
            return taskData.StepList?.FirstOrDefault(d => d.StepID == taskData.CurrentStepID);
        }

        public static string ToSimpleString(this TaskData taskInfo)
        {
            return $"【{taskInfo.TaskID} {taskInfo.ParentTaskID} {taskInfo.TaskState} {taskInfo.TaskBook} Step{taskInfo.CurrentStepID} AGV{taskInfo.Carrier} AGVType{taskInfo.CarrierType} {taskInfo.CreateTime} BindAGV{taskInfo.BindingAGVNumber}】";
        }

        public static string ToSimpleString(this StepData stepInfo)
        {
            return $"{stepInfo.TaskID} Step{stepInfo.StepID} {stepInfo.SystemStepState} {stepInfo.StepMoveName} {stepInfo.WareHouseID} 活动点{stepInfo.StationID} 导航点{stepInfo.VertexID} AGV行为码{stepInfo.AgvBehavior}({stepInfo.Param1},{stepInfo.Param2},{stepInfo.Param3}) PMS行为码{stepInfo.PmsBehavior} 开始{stepInfo.StartTime}";
        }

        public static string ToSimpleString(this ResultAgvData agvData)
        {
            return $"{agvData.AgvID}# 在线:{agvData.Online} 路段:{agvData.GraphEdge} 导航点:{agvData.GraphVertex} 逻辑位:{agvData.LogicBits} 上升:{agvData.LogicBits.GetBitVaule(9)} 下降:{agvData.LogicBits.GetBitVaule(10)}";
        }
    }
}
