using Expedience.Infrastructure;
using Expedience.Infrastructure.Models;
using Expedience.Web.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace Expedience.Web.Pages
{
    public class IndexModel : PageModel
    {
        private readonly IApiService _apiService;

        public List<DutyCompletionRecord>? DutyCompletionRecords { get; private set; }

        public IndexModel(IApiService apiService)
        {
            _apiService = apiService;
        }

        public async Task OnGet(string? expac, CancellationToken cancellationToken)
        {
            if (expac == null) expac = "EW";

            DutyCompletionRecords = await _apiService.GetDutyCompletionRecordsAsync(expac, cancellationToken);
        }
	}
}