using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion;
using BPA.SAAS.Manage.Application.Device.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.Product;
using Microsoft.AspNetCore.Components.Forms;
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 DeviceVesionServices: IDynamicApiController, ITransient
    {
        IDeviceVesionService _deviceVesionService;
        public DeviceVesionServices(IDeviceVesionService deviceVesionService)
        {
            _deviceVesionService= deviceVesionService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>

        [HttpPost("/api/devicevesion/page")]
        public async Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto)
        {
            return await _deviceVesionService.GetDeviceVesionPageAsync(inputDto);
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <returns></returns>
        [HttpPost("/api/devicevesion/add")]
        public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto)
        {
            return await _deviceVesionService.AddDeviceVesionAsync(inputDto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="inputList"></param>
        /// <returns></returns>
        [HttpPost("/api/devicevesion/delete")]
        public async Task<bool> DelDeviceVesionAsync(List<string> inputList)
        {
            return await _deviceVesionService.DelDeviceVesionAsync(inputList);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns></returns>
        [HttpPost("/api/devicevesion/update")]
        public async Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto)
        {
            return await _deviceVesionService.UpdateDeviceVesionAsync(inputDto);
        }
        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/devicevesion/updatestatus")]
        public async Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto)
        {
            return await _deviceVesionService.UpdateDeviceVesionSatatus(inputDto);
        }
        /// <summary>
        /// 根据设备编码查询版本
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        [HttpGet("/api/devicevesion/getdevicevesion")]
        public async Task<List<BPA_ProductVesion>> GetDeviceVesion(string productId)
        {
            return await _deviceVesionService.GetDeviceVesion(productId);
        }
        /// <summary>
        /// 查询版本列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/devicevesion/getdevicevesionlist")]
        public async Task<List<BPA_ProductVesion>> GetDeviceVesionList()
        {
            return await _deviceVesionService.GetDeviceVesionList();
        }
    }
}
