using EntityFrameworkCore.Projectables;
using IRaCIS.Core.Domain.Share;

namespace IRaCIS.Core.Domain.Models;

[Comment("后台 - 系统账户")]
[Table("User")]
public class User : BaseFullAuditEntity
{
    #region 导航属性

    [ForeignKey("UserTypeId")]
    public UserType UserTypeRole { get; set; }

    [JsonIgnore]
    public List<SystemDocConfirmedUser> SystemDocConfirmedList { get; set; }

    [JsonIgnore]
    public List<TrialUser> UserTrials { get; set; } = new List<TrialUser>();

    [JsonIgnore]
    public List<VisitTask> VisitTaskList { get; set; }

    [Projectable]
    public string FullName => LastName + " / " + FirstName;

    #endregion

    [Comment("自动切换下一个任务")]
    public bool AutoCutNextTask { get; set; }

    public int Code { get; set; }
    public string DepartmentName { get; set; } = null!;

    [Comment("医生生成账号后，会有值")]
    public Guid? DoctorId { get; set; }

    public string EMail { get; set; } = null!;

    [StringLength(1000)]
    public string EmailToken { get; set; } = null!;

    public string FirstName { get; set; } = null!;

    [Comment("首次登录需要修改密码")]
    public bool IsFirstAdd { get; set; } = true;

    public bool IsTestUser { get; set; }

    [Comment("内部用户  外部用户")]
    public bool IsZhiZhun { get; set; }

    [Comment("上一次修改密码的时间")]
    public DateTime? LastChangePassWordTime { get; set; }

    public string LastLoginIP { get; set; } = null!;

    public DateTime? LastLoginTime { get; set; }

    public string LastName { get; set; } = null!;

    public string OrganizationName { get; set; } = null!;

    public string Password { get; set; } = null!;

    public bool PasswordChanged { get; set; }

   
    public string Phone { get; set; } = null!;

   
    public string PositionName { get; set; } = null!;

    public int? Sex { get; set; }

    public UserStateEnum Status { get; set; } = UserStateEnum.Enable;

    public bool SuperAdmin { get; set; }

   
    public string UserCode { get; set; } = null!;

    public string UserName { get; set; } = null!;

    public UserTypeEnum UserTypeEnum { get; set; }

    public Guid UserTypeId { get; set; }
}
