using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction;
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 ProductFunctionServices: IDynamicApiController, ITransient
    {
        IProductFunctionService _deviceTechnologyService;
        public ProductFunctionServices(IProductFunctionService deviceTechnologyService)
        {
            _deviceTechnologyService= deviceTechnologyService;
        }
        /// <summary>
        /// 获取功能基础信息列表
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/page")]
        public async Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto)
        {
            return await _deviceTechnologyService.GetProductFunctionPage(inputDto);
        }
        /// <summary>
        /// 查询所有功能信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/productfunction/getdevicetechnology")]
        public async Task<List<ProductFunctionDto>> GetProductFunction()
        {
            return await _deviceTechnologyService.GetProductFunction();
        }
        /// <summary>
        /// 根据设备id查询产品功能和服务
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        [HttpGet("/api/productfunction/getproductfunction")]
        public async Task<List<ProductFunctionView>> GetProductFunction(string deviceId)
        {
            return await _deviceTechnologyService.GetProductFunction(deviceId);
        }
        /// <summary>
        /// 根据设备id查询产品功能和服务（外部调用）
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        [HttpGet("/api/productfunction/getproductfunction_alm")]
        [AllowAnonymous]
        public async Task<List<ProductFunctionView>> GetProductFunction_alm(string deviceId)
        {
            return await _deviceTechnologyService.GetProductFunction_alm(deviceId);
        }
        /// <summary>
        /// 添加功能
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/add")]
        public async Task<bool> AddProductFunction(ProductFunctionBaseDto inputDto)
        {
            return await _deviceTechnologyService.AddProductFunction(inputDto);
        }
        /// <summary>
        /// 修改功能
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/update")]
        public async Task<bool> UpdateProductFunction(ProductFunctionBaseDto inputDto)
        {
            return await _deviceTechnologyService.UpdateProductFunction(inputDto);
        }
        /// <summary>
        /// 删除功能
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/delete")]
        public async Task<bool> DeleteProductFunction(List<string> ids)
        {
            return await _deviceTechnologyService.DeleteProductFunction(ids);
        }
        /// <summary>
        /// 根据功能id查询功能参数
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/productfunction/getproductfunctionaction")]
        public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId)
        {
            return await _deviceTechnologyService.GetProductFunctionActionList(productFunctionId);
        }
        /// <summary>
        /// 查询所有功能参数
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/productfunction/getproductfunctionactionlist")]
        public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList()
        {
            return await _deviceTechnologyService.GetProductFunctionActionList();
        }
        /// <summary>
        /// 添加功能参数
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/addproductfunctionaction")]
        public async Task<bool> AddProductFunctionAction(ProductFunctionActionBaseDto inputDto)
        {
            return await _deviceTechnologyService.AddProductFunctionAction(inputDto);
        }
        /// <summary>
        /// 修改功能参数
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/updateproductfunctionaction")]
        public async Task<bool> UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto)
        {
            return await _deviceTechnologyService.UpdateProductFunctionAction(inputDto);
        }
        /// <summary>
        /// 删除功能参数
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/productfunction/delproductfunctionaction")]
        public async Task<bool> DeleteProductFunctionAction(List<string> ids)
        {
            return await _deviceTechnologyService.DeleteProductFunctionAction(ids);
        }
    }
}
