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

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

        public GlobalConfigController(ILogger<GlobalConfigController> logger, IGlobalConfigService globalConfigService)
        {
            this._globalConfigService = globalConfigService;
        }
        [HttpPost]
        public ApiResult AddGlobalConfig(GlobalConfigDTO  globalConfigDTO)
        {
            return _globalConfigService.AddGlobalConfig(globalConfigDTO);
        }


        [HttpPost]
        public ApiResult UpdateGlobalConfig(GlobalConfigDTO globalConfigDTO)
        {
            return _globalConfigService.UpdateGlobalConfig(globalConfigDTO);
        }

        [HttpGet("{id}")]
        public GlobalConfigDTO GetGlobalConfig(int id)
        {
            return _globalConfigService.GetGlobalConfig();
        }

        [HttpGet]
        public List<GlobalConfigDTO> GetAllGlobalConfig()
        {
            return _globalConfigService.GetAllGlobalConfig();
        }


    }
}
