using System.ComponentModel;
using Hotline.Identity.Accounts;
using Hotline.Identity.Roles;
using Hotline.Settings;
using Hotline.Share.Enums.Order;
using Hotline.Share.Enums.User;
using SqlSugar;
using XF.Domain.Entities;
using XF.Domain.Repository;

namespace Hotline.Users
{
    /// <summary>
    /// 用户
    /// </summary>
    [Description("用户")]
    public class User : CreationSoftDeleteEntity
    {
        /// <summary>
        /// 手机号(冗余)
        /// </summary>
        public string? PhoneNo { get; set; }

        /// <summary>
        /// 座机号码
        /// </summary>
        [SugarColumn(ColumnDescription = "座机号码", ColumnDataType = "varchar(50)")]
        public string? LandlineNumber { get; set; }

        /// <summary>
        /// 展示名称(Identity.DisplayName)
        /// </summary>
        public string Name { get; set; }

        public EGender Gender { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        public string? StaffNo { get; set; }

        /// <summary>
        /// 部门Id
        /// </summary>
        public string? OrgId { get; set; }

        /// <summary>
        /// 部门全称
        /// </summary>
        public string? FullOrgName { get; set; }

        /// <summary>
        /// 默认分机号
        /// </summary>
        public string? DefaultTelNo { get; set; }

        /// <summary>
        /// 默认分机组(技能组)
        /// </summary>
        public string? DefaultTelGroup { get; set; }

        /// <summary>
        /// 用户类型
        /// </summary>
        public EUserType UserType { get; set; }

        /// <summary>
        /// 旧系统用户id
        /// </summary>
        public int? OldUserId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>

        [Navigate(NavigateType.OneToOne, nameof(OrgId))]
        public SystemOrganize Organization { get; set; }

        [Navigate(NavigateType.OneToOne, nameof(Id))]
        public Account Account { get; set; }

        [Navigate(typeof(AccountRole), nameof(AccountRole.AccountId), nameof(AccountRole.RoleId))]
        public List<Role> Roles { get; set; }
    }
}
