using Fuel.Application.Service;
using Fuel.Core.Nozzle.Dto;
using Fuel.Core.Transactions.Dto;
using FuelServer.Core.Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Fuel.PaymentServer.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TransactionsController : ControllerBase
    {
        private readonly ITransactionsService _transactionsService;
        public TransactionsController(ITransactionsService transactionsService)
        { 
             _transactionsService = transactionsService;
        }
        /// <summary>
        /// 创建订单
        /// </summary>
        /// <param name="uploadTransactions"></param>
        /// <returns></returns>
        [Route("CreateTransactions")]
        [HttpPost]
        public async Task<transactions> CreateTransactionsAsync(UploadTransactions uploadTransactions)
        {
            return await _transactionsService.CreateTransactions(uploadTransactions);
        }
        /// <summary>
        /// 查询订单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [Route("GetTransactions")]
        [HttpPost]
        public async Task<List<transactions>> GetTransactionsAsync(TransactionsInput input)
        {
            return await _transactionsService.GetTransactionsAsync(input);
        }
    }
}
