using Newtonsoft.Json.Linq;

namespace MisDataSaveDate
{
    /// <summary>
    /// 临工AGV两点任务请求。
    /// </summary>
    public class LGAGV_AddTaskRequest
    {
        public string requestTaskId { get; set; }
        public string startPosition { get; set; }
        public string endPosition { get; set; }
        public string materialCode { get; set; }
    }

    /// <summary>
    /// 临工AGV三点任务请求。
    /// </summary>
    public class LGAGV_AddTask2Request
    {
        public string requestTaskId { get; set; }
        public string startPosition { get; set; }
        public string midPosition { get; set; }
        public string endPosition { get; set; }
        public string materialCode { get; set; }
    }

    /// <summary>
    /// 临工AGV放行请求。
    /// </summary>
    public class LGAGV_AllowLeaveRequest
    {
        public string requestId { get; set; }
        public string position { get; set; }
        public string agvNo { get; set; }
        public int allowLeave { get; set; } = 1;
    }

    /// <summary>
    /// 临工AGV到达/离开回调。
    /// </summary>
    public class LGAGV_StatusUpdateRequest
    {
        public string requestId { get; set; }
        public string position { get; set; }
        public int type { get; set; }
        public string materialCode { get; set; }
        public string agvNo { get; set; }
    }

    /// <summary>
    /// 临工AGV任务执行结果回调。
    /// </summary>
    public class LGAGV_TaskResultRequest
    {
        public string requestTaskId { get; set; }
        public string status { get; set; }
        public string agvNo { get; set; }
        public string message { get; set; }
        public string materialCode { get; set; }
    }

    /// <summary>
    /// 返回给临工AGV的通用响应。
    /// </summary>
    public class LGAGV_Response
    {
        public int code { get; set; }
        public string desc { get; set; }
        public bool success { get; set; }

        public static LGAGV_Response Success(string desc = "成功")
        {
            return new LGAGV_Response
            {
                code = 0,
                desc = desc,
                success = true
            };
        }

        public static LGAGV_Response Fail(string desc)
        {
            return new LGAGV_Response
            {
                code = 1,
                desc = desc,
                success = false
            };
        }
    }

    /// <summary>
    /// MES调用临工AGV接口后的内部结果。
    /// </summary>
    public class LGAGV_CallResult
    {
        public bool Success { get; set; }
        public int Code { get; set; }
        public string Message { get; set; }
        public string InterfaceUrl { get; set; }
        public string RequestText { get; set; }
        public string ResponseText { get; set; }
        public JObject Response { get; set; }
    }
}
