namespace ComputerShopWpf.Services
{
    public static class UserSession
    {
        public static int UserId { get; set; }
        public static string Login { get; set; }
        public static string RoleName { get; set; }

        public static bool IsAdmin()
        {
            return RoleName == "admin";
        }

        public static bool IsManager()
        {
            return RoleName == "manager";
        }

        public static bool IsViewer()
        {
            return RoleName == "viewer";
        }

        public static bool CanEditClients()
        {
            return IsAdmin() || IsManager();
        }

        public static bool CanEditOrders()
        {
            return IsAdmin() || IsManager();
        }

        public static bool CanEditProducts()
        {
            return IsAdmin() || IsManager();
        }

        public static bool CanDeleteClients()
        {
            return IsAdmin();
        }

        public static bool CanManageUsers()
        {
            return IsAdmin();
        }

        public static void Clear()
        {
            UserId = 0;
            Login = null;
            RoleName = null;
        }
    }
}
