using Microsoft.AspNetCore.Mvc;
using Idoklad.Services;
namespace Idoklad.Controllers;
///
/// Read-only iDoklad code lists / registers. Requires iDoklad credentials (headers or environment
/// defaults).
///
[ApiController]
[Produces("application/json")]
[Tags("CodeLists")]
public sealed class CodeListsController : ControllerBase
{
private readonly CodeListsService _service;
public CodeListsController(CodeListsService service) => _service = service;
/// List banks (paged).
[HttpGet("code-lists/banks")]
public async Task Banks(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListBanksAsync(page, pageSize, ct));
/// Get a bank detail by id.
[HttpGet("code-lists/banks/{id:int}")]
public async Task BankDetail(int id, CancellationToken ct)
=> Ok(await _service.BankDetailAsync(id, ct));
/// List countries (paged).
[HttpGet("code-lists/countries")]
public async Task Countries(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListCountriesAsync(page, pageSize, ct));
/// Get a country detail by id.
[HttpGet("code-lists/countries/{id:int}")]
public async Task CountryDetail(int id, CancellationToken ct)
=> Ok(await _service.CountryDetailAsync(id, ct));
/// List currencies (paged).
[HttpGet("code-lists/currencies")]
public async Task Currencies(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListCurrenciesAsync(page, pageSize, ct));
/// Get a currency detail by id.
[HttpGet("code-lists/currencies/{id:int}")]
public async Task CurrencyDetail(int id, CancellationToken ct)
=> Ok(await _service.CurrencyDetailAsync(id, ct));
/// List constant symbols (paged).
[HttpGet("code-lists/constant-symbols")]
public async Task ConstantSymbols(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListConstantSymbolsAsync(page, pageSize, ct));
/// Get a constant symbol detail by id.
[HttpGet("code-lists/constant-symbols/{id:int}")]
public async Task ConstantSymbolDetail(int id, CancellationToken ct)
=> Ok(await _service.ConstantSymbolDetailAsync(id, ct));
/// List exchange rates (paged).
[HttpGet("code-lists/exchange-rates")]
public async Task ExchangeRates(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListExchangeRatesAsync(page, pageSize, ct));
/// Get an exchange rate detail by id.
[HttpGet("code-lists/exchange-rates/{id:int}")]
public async Task ExchangeRateDetail(int id, CancellationToken ct)
=> Ok(await _service.ExchangeRateDetailAsync(id, ct));
/// List payment options (paged).
[HttpGet("code-lists/payment-options")]
public async Task PaymentOptions(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListPaymentOptionsAsync(page, pageSize, ct));
/// Get a payment option detail by id.
[HttpGet("code-lists/payment-options/{id:int}")]
public async Task PaymentOptionDetail(int id, CancellationToken ct)
=> Ok(await _service.PaymentOptionDetailAsync(id, ct));
/// List VAT codes (paged).
[HttpGet("code-lists/vat-codes")]
public async Task VatCodes(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListVatCodesAsync(page, pageSize, ct));
/// Get a VAT code detail by id.
[HttpGet("code-lists/vat-codes/{id:int}")]
public async Task VatCodeDetail(int id, CancellationToken ct)
=> Ok(await _service.VatCodeDetailAsync(id, ct));
/// List VAT reverse-charge codes (paged).
[HttpGet("code-lists/vat-reverse-charge-codes")]
public async Task VatReverseChargeCodes(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListVatReverseChargeCodesAsync(page, pageSize, ct));
/// Get a VAT reverse-charge code detail by id.
[HttpGet("code-lists/vat-reverse-charge-codes/{id:int}")]
public async Task VatReverseChargeCodeDetail(int id, CancellationToken ct)
=> Ok(await _service.VatReverseChargeCodeDetailAsync(id, ct));
/// List sales offices (paged).
[HttpGet("code-lists/sales-offices")]
public async Task SalesOffices(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListSalesOfficesAsync(page, pageSize, ct));
/// Get a sales office detail by id.
[HttpGet("code-lists/sales-offices/{id:int}")]
public async Task SalesOfficeDetail(int id, CancellationToken ct)
=> Ok(await _service.SalesOfficeDetailAsync(id, ct));
/// List sales POS equipment (paged).
[HttpGet("code-lists/sales-pos-equipment")]
public async Task SalesPosEquipment(int page = 1, int pageSize = 20, CancellationToken ct = default)
=> Ok(await _service.ListSalesPosEquipmentAsync(page, pageSize, ct));
/// Get a sales POS equipment detail by id.
[HttpGet("code-lists/sales-pos-equipment/{id:int}")]
public async Task SalesPosEquipmentDetail(int id, CancellationToken ct)
=> Ok(await _service.SalesPosEquipmentDetailAsync(id, ct));
}