using Fuel.Payment.Service.Pay;
using Microsoft.AspNetCore.Mvc;

namespace Fuel.PaymentServer.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class WeatherForecastController : ControllerBase
    {
        private static readonly string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };

        private readonly ILogger<WeatherForecastController> _logger;
        private readonly IPayService _payService;

        public WeatherForecastController(ILogger<WeatherForecastController> logger, IPayService payService)
        {
            _logger = logger;
            _payService = payService;
        }

        [HttpGet(Name = "GetWeatherForecast")]
        public IEnumerable<WeatherForecast> Get()
        {
            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
                TemperatureC = Random.Shared.Next(-20, 55),
                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
            })
            .ToArray();
        }
        public async Task<IActionResult> Payment()
        {
            await _payService.PerformElectronicProcess();
            return Ok(0);
        }
    }
}
