using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Responses;
using MongoDB.Bson;

namespace adas_core.Application.Services.Interfaces;

public interface IAuthService
{
    /// <summary>
    /// Asynchronously retrieves the current login response, returning <c>null</c> when no login state is available.
    /// </summary>
    /// <returns>A <see cref="Task{TResult}"/> that resolves to the current <see cref="LoginResponse"/>, or <c>null</c> if no login response exists.</returns>
    Task<LoginResponse?> GetLoginResponse();
    /// <summary>
    /// Asynchronously retrieves a token.
    /// </summary>
    /// <returns>A task that represents the asynchronous operation. The task result contains the retrieved token string.</returns>
    Task<string> GetToken();
    /// <summary>
    /// Retrieves a list of authorizations associated with the specified unit identifier.
    /// </summary>
    /// <param name="unitId">The unique identifier of the unit whose authorizations are being queried.</param>
    /// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> objects matching the provided unit identifier.</returns>
    Task<List<Authorization>> GetByUnitId(ObjectId unitId);
    /// <summary>
    /// Asynchronously deletes the record identified by the specified display identifier.
    /// </summary>
    /// <param name="displayId">The display identifier of the record to delete.</param>
    /// <returns>A task that represents the asynchronous operation, containing a value indicating whether the record was successfully deleted.</returns>
    Task<bool> DeleteByDisplayId(ObjectId displayId);
    /// <summary>
    /// Asynchronously deletes the entity associated with the specified unit identifier.
    /// </summary>
    /// <param name="unitId">The unique identifier of the unit whose associated entity should be deleted.</param>
    /// <returns>A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful.</returns>
    Task<bool> DeleteByUnitId(ObjectId unitId);
    /// <summary>
    /// Retrieves the list of authorizations associated with the specified user identifier.
    /// </summary>
    /// <param name="id">The unique identifier of the user whose authorizations are being retrieved.</param>
    /// <returns>A task that represents the asynchronous operation, containing the list of authorizations for the user.</returns>
    Task<List<Authorization>> GetUserAuthorities(ObjectId id);
}