using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Interface;
using Microsoft.AspNetCore.Mvc;

namespace DS.WMS.OpApi.Controllers;

/// <summary>
/// 收发通模板信息服务
/// </summary>
public class ShippingBillTemplateController : ApiController
{
    private readonly IShippingBillTemplateService _invokeService;

    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="invokeService"></param>
    public ShippingBillTemplateController(IShippingBillTemplateService invokeService)
    {
        _invokeService = invokeService;
    }

    /// <summary>
    /// 列表
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    [HttpPost]
    [Route("GetShippingBillTemplateList")]
    public DataResult<List<ShippingBillTemplateRes>> GetShippingBillTemplateList([FromBody] PageRequest request)
    {
        var res = _invokeService.GetListByPage(request);
        return res;
    }

    /// <summary>
    /// 收发通模板下拉列表
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    [HttpGet]
    [Route("GetShippingBillTemplateSelectList")]
    public DataResult<List<ShippingBillTemplateSelectRes>> GetShippingBillTemplateList([FromQuery] string type)
    {
        var res = _invokeService.GetShippingBillTemplateSelectList(type);
        return res;
    }
    /// <summary>
    /// 编辑
    /// </summary>
    /// <param name="model"></param>
    /// <returns></returns>
    [HttpPost]
    [Route("EditShippingBillTemplate")]
    public DataResult EditShippingBillTemplate([FromBody] ShippingBillTemplateReq model)
    {
        var res = _invokeService.EditShippingBillTemplate(model);
        return res;
    }

    /// <summary>
    /// 详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet]
    [Route("GetShippingBillTemplateInfo")]
    public DataResult<ShippingBillTemplateRes> GetShippingBillTemplateInfo([FromQuery] string id)
    {
        var res = _invokeService.GetShippingBillTemplateInfo(id);
        return res;
    }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet]
    [Route("DelShippingBillTemplate")]
    public DataResult DelShippingBillTemplate([FromQuery] string id)
    {
        var res = _invokeService.DelShippingBillTemplate(id);
        return res;
    }
    /// <summary>
    /// 批量删除
    /// </summary>
    /// <param name="req"></param>
    /// <returns></returns>
    [HttpPost]
    [Route("BatchDelShippingBillTemplate")]
    public DataResult BatchDelShippingBillTemplate([FromBody] IdModel req)
    {
        var res = _invokeService.BatchDelShippingBillTemplate(req);
        return res;
    }
}