using MadRunFabric.Common;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace MadRunFabric.Model.MessageApi
{
    /// <summary>
    /// 工单/用户关联表 - 记录每个用户是否已读信息
    /// </summary>
    [BsonIgnoreExtraElements]
    public class Wo_Order_User_Map : IBaseModel<string>
    {
        /// <summary>
        /// id
        /// </summary>
        [Key]
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string id { get; set; }
        /// <summary>
        /// 工单类型（枚举EnumOrderState） 
        /// 维修工单 = 1, 保养工单 = 2, 运行工单 = 3, 超时工单 = 4
        /// </summary>
        public int channelcode { get; set; }
        /// <summary>
        /// 工单编号
        /// </summary>
        public string wocode { get; set; }
        /// <summary>
        /// 工单id
        /// </summary>
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string woid { get; set; }
        /// <summary>
        /// 已读用户code
        /// </summary>
        public string readby { get; set; }
        /// <summary>
        /// 已读时间
        /// </summary>
        public DateTime readtime
        {
            get
            {
                return _readtime.ToLocalTime();
            }
            set
            {
                _readtime = value.ToLocalTime();
            }
        }
        private DateTime _readtime;
        /// <summary>
        /// 推送状态 (0未推送，1已推送)
        /// </summary>
        public int ispush { get; set; } = 0;
        /// <summary>
        /// 消息通知状态 (0未通知，1已通知)
        /// </summary>
        public int isnotice { get; set; } = 0;
        /// <summary>
        /// 是否已读 (0未读【推送消息】，1已读)
        /// </summary>
        public int isread { get; set; } = 0;
        /// <summary>
        /// 备注
        /// </summary>
        public string note { get; set; }
        /// <summary>
        /// 工单状态:0创建工单，1已转派，3已处理，6挂起 
        /// </summary>
        public int wostate { get; set; } = 0;
    }
}
