namespace MyOffice.Web.Controllers;

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Data.Repositories.Currency;
using Models.Currency;
using Services.Currency;

[Authorize]
[ApiController]
[Route("api/[controller]")]
public class GeneralController : BaseApiController
{
	private readonly CurrencyService _currencyService;

	public GeneralController(
		CurrencyService currencyService
	)
	{
		_currencyService = currencyService;
	}

	[HttpGet("~/api/general/currencies")]
	public object Get()
	{
		var list = _currencyService.GetGlobalAll();

		return list.Select(x => x.ToModel());
	}
}
