using System.ComponentModel.DataAnnotations;
using Asp.Versioning;
using Baya.Application.Features.Bookings.Commands.DetectNoShowSessions;
using Baya.Application.Features.Bookings.Queries.ListAdminEvv;
using Baya.Application.Models.Booking;
using Baya.Application.Models.Common;
using Baya.Infrastructure.Identity.Identity.PermissionManager;
using Baya.WebFramework.Attributes;
using Baya.WebFramework.BaseController;
using Baya.WebFramework.ServiceConfiguration;
using Mediator;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
namespace Baya.Web.Api.Controllers.V1;
///
/// The admin EVV-review surface: the mismatch/no-show queue and the manual no-show sweep trigger (the same
/// idempotent command the deferred cron will call).
///
[ApiVersion("1")]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[Authorize(ConstantPolicies.DynamicPermission)]
[EnableRateLimiting(RateLimitingServiceExtension.SensitivePolicy)]
[Display(Description = "Admin EVV review queue (location mismatch / no-show) + manual no-show sweep")]
public sealed class AdminEvvController(ISender sender) : BaseController
{
[HttpGet("[action]")]
[ProducesOkApiResponseType>]
public async Task List([FromQuery] ListAdminEvvQuery query, CancellationToken cancellationToken)
=> OperationResult(await sender.Send(query, cancellationToken));
[HttpPost("[action]")]
[ProducesOkApiResponseType]
public async Task DetectNoShows(CancellationToken cancellationToken)
=> OperationResult(await sender.Send(new DetectNoShowSessionsCommand(), cancellationToken));
}