using BPA.SAAS.Manage.Application.Device.Dtos.Device;
using BPA.SAAS.Manage.Application.Device.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.Device;
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 ProductServices: IDynamicApiController, ITransient
    {
        IProductService _productService;
        public ProductServices(IProductService productService)
        {
            _productService=productService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/product/page")]
        public async Task<PageUtil> GetProductPage(ProductQueryInputDto inputDto)
        {
            return await _productService.GetProductPage(inputDto);
        }
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/product/list")]
        public async Task<List<BPA_Product>> GetProductList()
        {
            return await _productService.GetProductList();
        }
        /// <summary>
        /// 根据产品id查询产品信息
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        [HttpGet("/api/product/getproduct")]
        public async Task<BPA_Product> GetProduct(string productId)
        {
            return await _productService.GetProduct(productId);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/product/add")]
        public async Task<bool> AddProduct(ProductBaseDto inputDto)
        {
            return await _productService.AddProduct(inputDto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="inputList"></param>
        /// <returns></returns>
        [HttpPost("/api/product/delete")]
        public async Task<bool> DeProduct(List<string> inputList)
        {
            return await _productService.DeProduct(inputList);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/product/update")]
        public async Task<bool> UpdateProduct(ProductBaseDto inputDto)
        {
            return await _productService.UpdateProduct(inputDto);
        }
        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/product/updatestatus")]
        public async Task<bool> UpdateDeviceVesionSatatus(ProductSatatusDto inputDto)
        {
            return await _productService.UpdateDeviceVesionSatatus(inputDto);
        }
    }
}
