using BPA.KitChen.GroupMeal.SqlSugar;
using BPA.SAAS.Manage.Application.Device.Dtos.Device;
using BPA.SAAS.Manage.Application.Device.Interface;
using BPA.SAAS.Manage.Comm.Model;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.System;
using Microsoft.AspNetCore.Components.Forms;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.Device
{
    [ApiDescriptionSettings("Device", Tag = "设备基础信息管理")]
    public class DeviceServices: IDynamicApiController, ITransient
    {
        IDeviceService _deviceService;
        public DeviceServices(IDeviceService deviceService)
        {
            _deviceService=deviceService;
        }
       /// <summary>
       /// 分页查询
       /// </summary>
       /// <param name="inputDto"></param>
       /// <returns></returns>
        [HttpPost("/api/device/page")]
        public async Task<PageUtil> GetDeviceInfoPage(DeviceQueryInputDto inputDto)
        {
            return await _deviceService.GetDeviceInfoPage(inputDto);
        }
        /// <summary>
        /// 查询设备列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/device/list")]
        public async Task<List<ListSelectDeviceQuery>> GetDeviceList()
        {
            return await _deviceService.GetDeviceList();
        }
        [HttpGet("/api/device/getdevicebystoplist")]
        public async Task<List<ListSelectDeviceQuery>> GetDeviceByStopList(string stopId)
        {
            return await _deviceService.GetDeviceByStopList(stopId);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/device/add")]
        public async Task<bool> AddDevice(DeviceInfoBaseDto inputDto)
        {
            return await _deviceService.AddDevice(inputDto);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/device/update")]
        public async Task<bool> UpdateDevice(DeviceInfoBaseDto inputDto)
        {
            return await _deviceService.UpdateDevice(inputDto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="inputList"></param>
        /// <returns></returns>
        [HttpPost("/api/device/delete")]
        public async Task<bool> DelDeviceInfo(List<string> inputList)
        {
            return await _deviceService.DelDeviceInfo(inputList);
        }
        /// <summary>
        /// 添加设备标签
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/device/adddevicetype")]
        public async Task<bool> AddDeviceTypeAsync(DeviceTypeBaseDto inputDto)
        {
            return await _deviceService.AddDeviceTypeAsync(inputDto);
        }
        /// <summary>
        /// 查询设备标签
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/device/getdevicetypelist")]
        public async Task<List<ListSelectQuery>> GetDeviceTypeList()
        {
            return await _deviceService.GetDeviceTypeList();
        }


        


    }
}
