using LHDN.CRM.Models.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LHDN.CRM.Models.ViewModels
{
    public class UserInfoViewModel
    {
        public string LoginID { get; set; }

        public long UserProfileID { get; set; }

        public string DisplayName { get; set; }

        public int JawatanID { get; set; } // CR Jan2020 (Chew)

        public string ShortName { get; set; }

        public string Email { get; set; }
        public bool HasManagerRole { get; set; }

        public DateTime CreatedDate { get; set; }

        public WorkflowUserViewModel Manager { get; set; }

        public UserUnitViewModel Unit { get; set; }

        public List<string> Roles { get; set; }
        public List<UserRole> RolesObj { get; set; }
        public List<RoleInfo> RoleGroups { get; set; }
        public List<TindakanSusulanViewModel> RoleTindakanSusulan { get; set; }
        public DateTime LastUpdatedDateTime { get; set; }

    }

    public class RoleInfo
    {
        public int FunctionalRoleID { get; set; }

        public string Role { get; set; }
    }

    public class UserRoleComparer : IEqualityComparer<UserRole>
    {

        public bool Equals(UserRole x, UserRole y)
        {
            if (x.RoleCode == y.RoleCode)
            {
                return true;
            }
            return false;
        }

        public int GetHashCode(UserRole obj)
        {
            return obj.FunctionalRoleID.GetHashCode();
        }

    }

}
