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.Companies;

[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)]
public class IndexModel(CompanyService companyService) : PageModel
{
    public List<Company> Items { get; private set; } = [];

    public async Task OnGetAsync(CancellationToken ct = default)
    {
        var (items, _) = await companyService.GetPagedAsync(1, 100, ct);
        Items = items.ToList();
    }
}
