using Hotline.Share.Dtos.Org;
using Hotline.Share.Dtos.Roles;
using Hotline.Share.Enums.Identity;
using Hotline.Share.Enums.Order;
using Hotline.Share.Enums.User;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Users;

public record UserDto : AddUserDto
{
    public string Id { get; set; }

    public string GenderText => Gender.GetDescription();

    public DateTime CreationTime { get; set; }

    public string UserTypeText => UserType.GetDescription();

    public string RoleNames { get; set; }

    public string State { get; set; }

    public bool IsDeleted { get; set; }

    //public string? FullOrgName { get; set; }


    public IReadOnlyList<RoleDto> Roles { get; set; }

    public OrgDto Organization { get; set; }
}

public record AddUserDto
{
    /// <summary>
    /// 账号
    /// </summary>
    public string UserName { get; set; }

    /// <summary>
    /// 手机号(冗余)
    /// </summary>
    public string? PhoneNo { get; set; }

    /// <summary>
    /// 座机号码
    /// </summary>
    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 EUserType UserType { get; set; }

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

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

    public string Email { get; set; }

    /// <summary>
    /// 账号类型
    /// </summary>
    public EAccountType AccountType { get; set; } = EAccountType.Personal;

    public ICollection<string> RoleIds { get; set; }
}

public record UpdateUserDto
{
    public string Id { get; set; }

    /// <summary>
    /// 手机号(冗余)
    /// </summary>
    public string? PhoneNo { get; set; }

    /// <summary>
    /// 座机号码
    /// </summary>
    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 EUserType UserType { get; set; }

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

    public string Email { get; set; }

    public ICollection<string> RoleIds { get; set; }
}