using Microsoft.AspNetCore.Mvc;
using Idoklad.Services;

namespace Idoklad.Controllers;

/// <summary>
/// Account agenda: the current agenda (company) and current user. Requires iDoklad credentials
/// (headers or environment defaults).
/// </summary>
[ApiController]
[Route("account")]
[Produces("application/json")]
[Tags("Account")]
public sealed class AccountController : ControllerBase
{
    private readonly AccountService _service;

    public AccountController(AccountService service) => _service = service;

    /// <summary>Get information about the current agenda (company).</summary>
    [HttpGet("agenda")]
    public async Task<IActionResult> Agenda(CancellationToken ct)
        => Ok(await _service.CurrentAgendaAsync(ct));

    /// <summary>Get information about the current user.</summary>
    [HttpGet("user")]
    public async Task<IActionResult> CurrentUser(CancellationToken ct)
        => Ok(await _service.CurrentUserAsync(ct));
}
