using System.Net; using TIAM.Core.Consts; using TIAM.Entities.Products; using TIAM.Entities.Users; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models; using static System.Runtime.InteropServices.JavaScript.JSType; namespace TIAMMobileApp.Services { public class SessionServiceMobile : ISessionService { public string? SessionId { get; set; } public UserSessionModel? User { get; set; } public IPAddress? IPAddress { get; set; } public bool IsAuthenticated { get; set; } = false; public bool HasCompany { get; set; } = false; public bool IsDriver { get; set; } = false; public bool IsDevAdmin { get; set; } = false; public bool IsSysAdmin { get; set; } = false; public List GetHotels() { if (User.UserModelDto.Products.Count > 0) { return User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList(); } else return new List(); } public Guid DriverPersmissionId { get; set; } = Guid.Empty; public async Task ClearAll() { SessionId = ""; User = null; IPAddress = null; IsAuthenticated = false; HasCompany = false; IsDriver = false; IsDevAdmin = false; IsSysAdmin = false; DriverPersmissionId = Guid.Empty; } } }