using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Khd.Core.Domain.Dto.agv
{
    [Table("wcs_agv_status")]
    public class WcsAgvStatus
    {
        [Column("battery")]
        public string Battery { get; set; }
        [Column("exclType")]
        public string ExclType { get; set; }
        [Column("mapCode")]
        public string MapCode { get; set; }
        [Column("online")]
        public string Online { get; set; }
        [Column("path")]
        public string? Path2
        {
            get
            {
                if (path != null && path.Length > 0)
                {
                    string json = JsonConvert.SerializeObject(path);
                    return json;
                }
                else
                {
                    return "";
                }
            }
            set
            {
                if (value != null && value.Length > 0)
                {
                    path = JsonConvert.DeserializeObject<string[]>(value);
                }
                else
                {
                    path = null;
                }
            }
        }
        public string[] path;
        [Column("podCode")]
        public string PodCode { get; set; }
        [Column("podDir")]
        public string PodDir { get; set; }
        [Column("posX")]
        public string PosX { get; set; }
        [Column("posY")]
        public string PosY { get; set; }
        [Key]
        [Column("robotCode")]
        public string RobotCode { get; set; }
        [Column("robotDir")]
        public string RobotDir { get; set; }
        [Column("robotIp")]
        public string robotIp { get; set; }
        [Column("speed")]
        public string Speed { get; set; }
        [Column("status")]
        public string Status { get; set; }
        [Column("stop")]
        public string Stop { get; set; }
        [Column("timestamp")]
        public DateTime? DateNow { get; set; }
    }
}
