using Microsoft.AspNetCore.Mvc;
using Services;
using ReAct_PME.Application;

namespace ReAct_PME.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ParametresController(IParametresService service) : Controller
    {
        [HttpGet("CompteMailUser")]
        public async Task<ActionResult<CompteMailUser>> LoadParametresCompteMailUser()
        {
            var data = await service.LoadParametresCompteMailUser();
            if (data == null)
                return NotFound();
            return Ok(data);
        }

        [HttpPost("CompteMailUser")]
        public async Task<ActionResult> SaveParametresCompteMailUser([FromBody] CompteMailUser compte)
        {
            var ok = await service.SaveParametresCompteMailUser(compte);
            if (!ok)
                return BadRequest();
            return Ok();
        }
    }
}
