using adas_core.Domain.Models.Responses; namespace adas_core.Domain.Utils; /// /// Provides a set of static utility methods for authentication-related operations. /// /// /// This class is sealed and cannot be inherited. /// /// public sealed class AuthUtils { private LoginResponse _loginResponse = new(); /// /// Static constructor that initializes the static field of the class by assigning a new instance if it has not already been set. /// /// static AuthUtils() { InternalInstance ??= new AuthUtils(); } /// /// Initializes a new instance of the authentication utility class and stores a self-reference in , allowing callers to retrieve the active instance through that property. /// /// public AuthUtils() { InternalInstance = this; } public LoginResponse LoginResponse { get { lock (_loginResponse) { return _loginResponse; } } set { lock (_loginResponse) { _loginResponse = value; } } } private static AuthUtils InternalInstance { get; set; } public static AuthUtils Instance => InternalInstance; /// /// Retrieves the current in a thread-safe manner by acquiring a lock on the underlying field. /// /// The current instance. /// public LoginResponse GetLoginResponse() { lock (_loginResponse) { return _loginResponse; } } }