using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using XYY.Authentication.Standard;
using XYY.Core.Standard.Mvc;
using XYY.Service.Standard.Finance;

namespace XYY.Api.Finance.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ExpressBulkAdjustmentQuoteController : ApiControllerBase
    {
        IExpressBulkAdjustmentQuoteService _expressBulkAdjustmentQuoteService;
        public ExpressBulkAdjustmentQuoteController(IExpressBulkAdjustmentQuoteService expressBulkAdjustmentQuoteService)
        {
            _expressBulkAdjustmentQuoteService=expressBulkAdjustmentQuoteService;
        }
        public async Task<IActionResult> GenerateQuotation()
        {
            var result= await _expressBulkAdjustmentQuoteService.GenerateQuotation();
            return Ok(result);
        }

        /// <summary>
        /// 执行生成文件，本地存储
        /// 逐条生成，多次调用，间隔调用时间
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public async Task<IActionResult> GenerateCustomerFile(int fileCount)
        {
            var result = await _expressBulkAdjustmentQuoteService.GenerateCustomerFile(fileCount);
            return Ok(result);
        }
        /// <summary>
        /// 合并文件，并发送
        /// 依据状态进行处理
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public async Task<IActionResult> GenerateZipFile()
        {
            var result = await _expressBulkAdjustmentQuoteService.GenerateZipFile();
            return Ok(result);
        }
        public async Task<IActionResult> AddQuoteJobBySales(int channelId)
        {

            int userId = User.GetUserContent().Id;
            await _expressBulkAdjustmentQuoteService.AddQuoteJobBySales(userId,channelId);
            return Ok();
        }
    }
}
