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

namespace MadRunFabric.Model
{
    public class Sys_Login_Logs : IBaseModel<string>
    {
        /// <summary>
        /// id
        /// </summary>
        [Key]
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string id { get; set; }

        /// <summary>
        /// 用户名字
        /// </summary>
        public string username { get; set; }

        /// <summary>
        /// 用户工号
        /// </summary>
        public string usercode { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string result { get; set; }

        /// <summary>
        /// ip  
        /// </summary>
        public string login_ip { get; set; }

        /// <summary>
        /// hostname
        /// </summary>
        public string hostname { get; set; }

        /// <summary>
        /// 渠道来源 1表示PC 2表示安卓 3表示IOS 4表示微信
        /// </summary>
        public int channel { get; set; } = 1;

        private DateTime _time = DateTime.Now.ToLocalTime();
        /// <summary>
        /// 登录登出时间
        /// </summary>
        public DateTime time
        {
            get
            {
                return _time.ToLocalTime();
            }
            set
            {
                _time = value; //确保可为null
            }
        }

        /// <summary>
        /// 1表示未删除
        /// </summary>
        public int state { get; set; } = 1;

        /// <summary>
        /// 当前用户id
        /// </summary>
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string user_id { get; set; }

    }
}
