using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute;
using BPA.SAAS.Manage.Application.DataBase.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.DataBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.DataBase
{
    [ApiDescriptionSettings("Goods", Tag = "商品属性管理")]
    public class GoodsAttributeServices: IDynamicApiController, ITransient
    {
        IGoodsAttributeService _goodsAttributeServices;
        public GoodsAttributeServices(IGoodsAttributeService goodsAttributeServices)
        {
            _goodsAttributeServices = goodsAttributeServices;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/goodsattribute/getgoodsattributepage")]
        public PageUtil GetGoodsAttributePageAsync(GoodsAttributeQueryDto dto)
        {
            return _goodsAttributeServices.GetGoodsAttributePageAsync(dto);
        }
        /// <summary>
        /// 查询商品属性（外部调用）
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/goodsattribute/getgoodsattributelist_alm")]
        [AllowAnonymous]
        public async Task<List<GoodsAttributeView>> GetGoodsAttributeList_alm()
        {
            return await _goodsAttributeServices.GetGoodsAttributeList_alm();
        }
        /// <summary>
        /// 添加/修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/goodsattribute/addgoodsattribute")]
        public async Task<bool> AddGoodsAttribute(GoodsAttributeDto dto)
        {
            return await _goodsAttributeServices.AddGoodsAttribute(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        [HttpPost("/api/goodsattribute/deletegoodsattribute")]
        public async Task<bool> DeleteGoodsAttribute([FromBody] string[] Ids)
        {
            return await _goodsAttributeServices.DeleteGoodsAttribute(Ids);
        }
        /// <summary>
        /// 查询商品属性值列表
        /// </summary>
        /// <param name="goodsAttributeId"></param>
        /// <returns></returns>
        [HttpGet("/api/goodsattribute/getgoodsattributevalue")]
        public async Task<List<BPA_GoodsAttributeValue>> GetGoodsAttributeValueAsync(string goodsAttributeId)
        {
            return await _goodsAttributeServices.GetGoodsAttributeValueAsync(goodsAttributeId);
        }
        /// <summary>
        /// 添加/修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/goodsattribute/addgoodsattributevalue")]
        public async Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValueDto> dto)
        {
            return await _goodsAttributeServices.AddGoodsAttributeValue(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("/api/goodsattribute/deletegoodsattributevalue")]
        public async Task<bool> DeleteGoodsAttributeValue(string id)
        {
            return await _goodsAttributeServices.DeleteGoodsAttributeValue(id);
        }
        /// <summary>
        /// 根据商品id查询商品属性
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("/api/goodsattribute/getbygoodsidattribute")]
        public async Task<List<GoodsAttributeList>> GetByGoodsIdAttribute(string id)
        {
            return await _goodsAttributeServices.GetByGoodsIdAttribute(id);
        }
        
    }
}
