using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Txgy.RBS.DTO;
using Txgy.RBS.Framework.Api;
using Txgy.RBS.IServices;

namespace Txgy.RBS.Server.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TimeTabController : ControllerBase
    {
        private readonly ITimeTabService _timeTabService;

        public TimeTabController(ILogger<TimeTabController> logger, ITimeTabService timeTabService)
        {
            this._timeTabService = timeTabService;
        }

        [HttpPost]
        public ApiResult AddTimeTab(TimeTabDTO timeTabDTO)
        {
            return _timeTabService.AddTimeTab(timeTabDTO);
        }

        [HttpDelete("{id}")]
        public ApiResult DeleteTimeTab(int id)
        {
            return _timeTabService.DeleteTimeTab(id);
        }

        [HttpPost]
        public ApiResult UpdateTimeTab(TimeTabDTO timeTabDTO)
        {
            return _timeTabService.UpdateTimeTab(timeTabDTO);
        }

        [HttpGet("{id}")]
        public TimeTabDTO GetTimeTab(int id)
        {
            return _timeTabService.GetTimeTab(id);
        }

        [HttpGet]
        public List<TimeTabDTO> GetAllTimeTabs()
        {
            return _timeTabService.GetAllTimeTab();
        }
    }
}
