using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Application.Services;
using TaxBaik.Domain.Entities;
using TaxBaik.Web.Services;

namespace TaxBaik.Web.Pages.Admin.Inquiries;

[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)]
public class IndexModel(InquiryService inquiryService) : PageModel
{
    public List<Inquiry> Items { get; private set; } = [];
    public string? Status { get; set; }

    public async Task OnGetAsync(string? status = null, CancellationToken ct = default)
    {
        Status = status;
        var (items, _) = await inquiryService.GetPagedAsync(1, 100, status, ct);
        Items = items.ToList();
    }
}
