using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.Model;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.DAL.DbModels;

namespace WCS.WebApi.Controllers
{
    /// <summary>
    /// 货架管理、模组管理、库位管理的接口
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    public class StoreInfoController : ControllerBase
    {
        public IStoreInfoService _storeInfoService { get; set; }
        public StoreInfoController(IStoreInfoService storeInfoService)
        {
            _storeInfoService = storeInfoService;
        }

        #region 货架管理
        [Route("getShelves")]
        [HttpPost(Name = "getShelves")]
        public async Task<ResponseBase> getShelves(GetShelvesRequest request)
        {
            return await _storeInfoService.GetShelves(request);
        }

        [HttpPost("addOrUpdateShelfInfo")]
        public async Task<ResponseCommon<object>> addOrUpdateShelfInfo(AddShelfInfoRequest<ShelfInfo> request)
        {
            return await _storeInfoService.addOrUpdateShelfInfo(request);
        }

        [HttpPost("GenerateStoreInfo")]
        public async Task<ResponseCommon<object>> GenerateStoreInfo()
        {
            return await _storeInfoService.GenerateStoreInfo();
        }
        #endregion


        #region 模组管理
        [Route("getModules")]
        [HttpPost(Name = "getModules")]
        public async Task<ResponseBase> getModules(GetModulesRequest request)
        {
            return await _storeInfoService.GetModules(request);
        }

        [Route("disableOrEnableModule")]
        [HttpPost(Name = "disableOrEnableModule")]
        public async Task<ResponseBase> disableOrEnableModule(DisableOrEnableModuleRequest request)
        {
            return await _storeInfoService.disableOrEnableModule(request);
        }

        [Route("queryModuleVoltage")]
        [HttpPost(Name = "queryModuleVoltage")]
        public async Task<ResponseBase> queryModuleVoltage(QueryModuleVoltageRequest request)
        {
            return await _storeInfoService.queryModuleVoltage(request);
        }

        [Route("calibrationSetOffset")]
        [HttpPost(Name = "calibrationSetOffset")]
        public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
        {
            return await _storeInfoService.calibrationSetOffset(request);
        }
        #endregion

        #region 库位管理
        [Route("getStores")]
        [HttpPost(Name = "getStores")]
        public async Task<ResponseBase> getStores(GetStoresRequest request)
        {
            return await _storeInfoService.GetStores(request);
        }

        [Route("disableOrEnableStore")]
        [HttpPost(Name = "disableOrEnableStore")]
        public async Task<ResponseBase> disableOrEnableStore(DisableOrEnableStoreRequest request)
        {
            return await _storeInfoService.disableOrEnableStore(request);
        }
        #endregion
    }
}
