using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LHDN.CRM.Models.ViewModels
{
    public class UserRoleDetailViewModel
    {
        public int FunctionalRoleID { get; set; }
        public string RoleName { get; set; }
        public bool IsActive { get; set; }
        public bool SelectAll { get; set; }

        public byte[] ChangeStamp { get; set; }
        public List<TaskCategory> TaskCategory { get; set; }
        public List<RoleUnit> RoleUnits { get; set; }
    }

    public class RoleUnit
    {
        public int UnitID { get; set; }
        public string UnitName { get; set; }
        public int BranchID { get; set; }
        public string BranchName { get; set; }
        public string DisplayBranchName { get; set; }
        public string AdditionalInfo { get; set; }
        public int HierarchyType { get; set; }
        public bool IsHide { get; set; }
        public List<RoleMember> RoleMembers { get; set; }
    }

    public class RoleMember
    {
        public long UserProfileID { get; set; }
        public int UnitID { get; set; }
        public string DisplayName { get; set; }
    }

    public class RoleMemberComparer : IEqualityComparer<RoleMember>
    {
        public bool Equals(RoleMember x, RoleMember y)
        {
            if (x.UnitID == y.UnitID && x.UserProfileID == y.UserProfileID)
            {
                return true;
            }
            return false;
        }

        public int GetHashCode(RoleMember obj)
        {
            return obj.UserProfileID.GetHashCode();
        }
    }

}
