using IdokladSdk.Models.Account;
using Idoklad.Client;

namespace Idoklad.Services;

/// <summary>Account agenda: information about the current agenda and the current user.</summary>
public sealed class AccountService
{
    private readonly IdokladApiAccessor _accessor;

    public AccountService(IdokladApiAccessor accessor) => _accessor = accessor;

    public async Task<AgendaGetModel> CurrentAgendaAsync(CancellationToken ct)
        => (await _accessor.Api.AccountClient.Agendas.Current().GetAsync(ct)).Unwrap();

    public async Task<UserGetModel> CurrentUserAsync(CancellationToken ct)
        => (await _accessor.Api.AccountClient.Users.Current().GetAsync(ct)).Unwrap();
}
