using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Services;
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsEnergyConfig;
using BPA.SAAS.Manage.Core.Base;
using Microsoft.AspNetCore.Components.Forms;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
{
    [ApiDescriptionSettings("开放平台", Tag = "商品管理"), AllowAnonymous]
    public class GoodsServices: IDynamicApiController
    {
        private readonly IGoodsService _goodsService;
        public GoodsServices(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        /// <summary>
        /// 分页查询商品
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsPageList")]
        public async Task<PageUtil<List<GoodsDto>>> GetGoodsPageList(GoodsPageInputDto inputDto)
        {
            return await _goodsService.GetGoodsPageList(inputDto);
        }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/AddGoods")]
        public async Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto)
        {
            return await _goodsService.AddGoods(dto);
        }
        /// <summary>
        /// 更新商品
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/UpdateGoods")]
        public async Task<bool> UpdateGoods(BaseRequestDto<GoodsUpdateDto> dto)
        {
            return await _goodsService.UpdateGoods(dto);
        }
        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/DeleteGoods")]
        public async Task<bool> DeleteGoods(DeleteGoodsDto dto)
        {
            return await _goodsService.DeleteGoods(dto);
        }
        /// <summary>
        ///添加商品属性
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttribute")]
        public async Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto)
        {
            return await _goodsService.AddGoodsAttribute(dto);
        }
        /// <summary>
        /// 添加商品属性值
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttributeValue")]
        public async Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto)
        {
            return await _goodsService.AddGoodsAttributeValue(dto);
        }
        /// <summary>
        /// 查询商品属性
        /// </summary>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsAttributeList")]
        public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto)
        {
            return await _goodsService.GetGoodsAttributeList(dto);
        }
        /// <summary>
        /// 查询商品工艺
        /// </summary>
        /// <param name="goodsId"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsTechnologyAction")]
        public async Task<List<GoodsTechnologyActionListViewDto>> GetGoodsTechnologyAction(GoodsIdDto goodsId)
        {
            return await _goodsService.GetGoodsTechnologyAction(goodsId);
        }
        /// <summary>
        /// 查询商品分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsTypePage")]
        public async Task<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto)
        {
            return await _goodsService.GetGoodsTypePage(dto);
        }
        /// <summary>
        /// 添加商品分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/AddGoodsType")]
        public async Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto)
        {
            return await _goodsService.AddGoodsType(dto);
        }
        /// <summary>
        /// 修改商品分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsType")]
        public async Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto)
        {
            return await _goodsService.UpdateGoodsType(dto);
        }
        /// <summary>
        /// 删除商品分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/DelGoodsType")]
        public async Task<bool> DelGoodsType(GoodstypeDelDto dto)
        {
            return await _goodsService.DelGoodsType(dto);
        }
        /// <summary>
        /// 查询商品单位
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsUintPage")]
        public async Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto dto)
        {
            return await _goodsService.GetGoodsUintPage(dto);
        }
        /// <summary>
        ///添加商品单位
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/AddGoodsUint")]
        public async Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto)
        {
            return await _goodsService.AddGoodsUint(dto);
        }
        /// <summary>
        ///修改商品单位
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsUint")]
        public async Task<bool> UpdateGoodsUint(GoodsUintUpdateDto dto)
        {
            return await _goodsService.UpdateGoodsUint(dto);
        }
        /// <summary>
        ///删除商品单位
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/DelGoodsUint")]
        public async Task<bool> DelGoodsUint(GoodsUintDelDto dto)
        {
            return await _goodsService.DelGoodsUint(dto);
        }
        /// <summary>
        /// 查询商品能量配置
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Goods/GetGoodsEnergyConfig")]
        public async Task<List<GoodsEnergyConfigVuewDto>> GetGoodsEnergyConfigPage(GoodsEnergyConfigQuDto dto)
        {
            return await _goodsService.GetGoodsEnergyConfigPage(dto);
        }
    }
}
