using BPA.SAAS.Manage.Application.AExternalPlatform.Enum;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos;
using BPA.SAAS.Manage.Comm.Enum;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.DataBase;
using BPA.SAAS.Manage.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Forms;
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Services
{
   
    [ApiDescriptionSettings("开放平台", Tag = "物料管理"), AllowAnonymous]
    public class MaterialServices : IDynamicApiController
    {
        private readonly IMaterialServices _materialServices;
        public MaterialServices(IMaterialServices materialServices)
        {
            _materialServices=materialServices;
        }

        /// <summary>
        /// 分页查询物料
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Material/GetMaterialPageList")]
        public async Task<PageUtil<List<MaterialDto>>> GetMaterialPageList(MaterialPageInputDto inputDto)
        {
            return await _materialServices.GetMaterialPageList(inputDto);
        }


        /// <summary>
        /// 添加物料
        /// </summary>
        /// <param name="InputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Material/AddMaterial")]
        public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> InputDto)
        {
            return await _materialServices.AddMaterial(InputDto);
        }

        /// <summary>
        /// 删除物料
        /// </summary>
        /// <param name="MaterialId"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Material/DelMaterial")]
        public async Task<bool> DelMaterial(DelMaterialDto inputDto)
        {
            return await _materialServices.DelMaterial(inputDto);
        }


        /// <summary>
        /// 修改物料
        /// </summary>
        /// <param name="InputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Material/UpdateMateria")]
        public async Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> InputDto)
        {
            return await _materialServices.UpdateMateria(InputDto);
        }
    }
}
