using DoliMiddlewareApi.Dtos.query.Setup; using DoliMiddlewareApi.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace DoliMiddlewareApi.Controllers; [ApiController] [Route("api/[controller]")] [Authorize] public class SetupController(SetupService setupService) : ControllerBase { [HttpGet("payment-types")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task>> GetPaymentTypes() { var paymentTypes = await setupService.GetPaymentTypesAsync(); return Ok(paymentTypes); } [HttpGet("countries")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task>> GetCountries() { var countries = await setupService.GetCountriesAsync(); return Ok(countries); } [HttpGet("civilities")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task>> GetCivilities() { var civilities = await setupService.GetCivilitiesAsync(); return Ok(civilities); } [HttpGet("contact-types")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task>> GetContactTypes() { var contactTypes = await setupService.GetContactTypesAsync(); return Ok(contactTypes); } [HttpGet("payment-terms")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task>> GetPaymentTerms() { var paymentTerms = await setupService.GetPaymentTermsAsync(); return Ok(paymentTerms); } [HttpGet("company")] [ProducesResponseType(typeof(CompanyDto), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] public async Task> GetCompany() { var company = await setupService.GetCompanyAsync(); return Ok(company); } }