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

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

    public async Task OnGetAsync(CancellationToken ct = default)
        => Items = (await announcementService.GetAllAsync(ct)).ToList();
}
