using OF_DL.Models;
using UserEntities = OF_DL.Models.Entities.Users;

namespace OF_DL.Services;

public interface IAuthService
{
    /// <summary>
    /// Gets or sets the current authentication state.
    /// </summary>
    Auth? CurrentAuth { get; set; }

    /// <summary>
    /// Loads authentication data from the disk.
    /// </summary>
    Task<bool> LoadFromFileAsync(string filePath = "auth.json");

    /// <summary>
    /// Launches a browser session and extracts auth data after login.
    /// </summary>
    Task<bool> LoadFromBrowserAsync();

    /// <summary>
    /// Persists the current auth data to disk.
    /// </summary>
    Task SaveToFileAsync(string filePath = "auth.json");

    /// <summary>
    ///     Cleans up the cookie string to only contain auth_id and sess cookies.
    /// </summary>
    void ValidateCookieString();

    /// <summary>
    ///     Validates auth by calling the API and returns the user info if valid.
    /// </summary>
    Task<UserEntities.User?> ValidateAuthAsync();

    /// <summary>
    ///     Logs out by deleting chrome-data and auth.json.
    /// </summary>
    void Logout();
}
