using Core.Interfaces;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace phronCare.API.Controllers.Sales
{
    [Route("api/[controller]")]
    [ApiController]
    public class AdjustmentReasonController : ControllerBase
    {
        private readonly IAdjustmentReasonDom _adjustmentReasonDom;
        public AdjustmentReasonController(IAdjustmentReasonDom adjustmentReasonService)
        {
            _adjustmentReasonDom = adjustmentReasonService ?? throw new ArgumentNullException(nameof(adjustmentReasonService));
        }
        [HttpGet("GetAll")]
        public async Task<IActionResult> GetAll()
        {
            try
            {
                var result = await _adjustmentReasonDom.GetAllActiveAsync();
                return Ok(result);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
    }
}
