using SqlSugar;
using System;

namespace DeviceRepairAndOptimization.Models
{
    [SugarTable("DriveMaintencePlan")]
    public class DrivePlan
    {
        /// <summary>
        /// 自增长主键
        /// <summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int AutoID { get; set; }

        /// <summary>
        /// 设备编号
        /// <summary>
        [SugarColumn(ColumnName = "EquipmentID")]
        public int EquipmentID { get; set; }

        /// <summary>
        /// 预计保养日期
        /// <summary>
        [SugarColumn(ColumnName = "CompleteDate")]
        public DateTime? CompleteDate { get; set; }

        /// <summary>
        /// 保养年份
        /// <summary>
        [SugarColumn(ColumnName = "MaintenanceYear")]
        public int MaintenanceYear { get; set; }

        /// <summary>
        /// 保养月份
        /// <summary>
        [SugarColumn(ColumnName = "MaintenanceMonth")]
        public int MaintenanceMonth { get; set; }

        /// <summary>
        /// 保养类型(Semi-an、Quarterly、Annual、Monthly)
        /// <summary>
        [SugarColumn(ColumnName = "MaintenanceType")]
        public string MaintenanceType { get; set; }

        /// <summary>
        /// 新PM起始月份
        /// <summary>
        [SugarColumn(ColumnName = "PMStartMonth")]
        public DateTime PMStartMonth { get; set; }

        /// <summary>
        /// 创建日期
        /// <summary>
        [SugarColumn(ColumnName = "CreatDate")]
        public DateTime CreatDate { get; set; }

        /// <summary>
        /// 创建人
        /// <summary>
        [SugarColumn(ColumnName = "CreatUser")]
        public int CreatUser { get; set; }

        /// <summary>
        /// 修改日期
        /// <summary>
        [SugarColumn(ColumnName = "ChangeDate")]
        public DateTime ChangeDate { get; set; }

        /// <summary>
        /// 修改人
        /// <summary>
        [SugarColumn(ColumnName = "ChangeUser")]
        public int ChangeUser { get; set; }

        /// <summary>
        /// 备注
        /// <summary>
        [SugarColumn(ColumnName = "Remarks")]
        public string Remarks { get; set; }

        /// <summary>
        /// 计划维修时间
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string PlanMaintenanceDate
        {
            get { return MaintenanceYear + "-" + MaintenanceMonth.ToString().PadLeft(2, '0'); }
        }


        [SugarColumn(IsIgnore = true)] public string MonthStr { get; set; }
    }
}