namespace TaxCalculator.Api.Controllers
{
    using Domain;
    using Microsoft.AspNetCore.Mvc;
    using TaxCalculator.Models;

    [Route("api/[controller]")]
    [ApiController]
    public class SalaryController : ControllerBase
    {
        private readonly ISalaryService _salaryService;

        public SalaryController(ISalaryService salaryService)
        {
            _salaryService = salaryService;
        }

        [HttpPost]
        public async Task<SalaryDetails> Post([FromBody] int grossAnnualSalary)
        {
            var salaryDetails = await _salaryService.CalculateSalaryDetails(grossAnnualSalary);

            return salaryDetails;
        }
    }
}
