using System.ComponentModel.DataAnnotations;
using Asp.Versioning;
using Baya.Application.Features.Reviews.Queries.GetReviewModerationQueue;
using Baya.Application.Models.Common;
using Baya.Application.Models.Reviews;
using Baya.Infrastructure.Identity.Identity.PermissionManager;
using Baya.WebFramework.Attributes;
using Baya.WebFramework.BaseController;
using Mediator;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Baya.Web.Api.Controllers.V1;

/// <summary>Admin review console: the moderation queue (defaults to <c>pending_moderation</c>), with any linked
/// low-rating alert id. Support alerts themselves stay internal — only their id is surfaced here for triage.</summary>
[ApiVersion("1")]
[ApiController]
[Route("api/v{version:apiVersion}/admin/reviews")]
[Authorize(ConstantPolicies.DynamicPermission)]
[Display(Description = "Admin review moderation queue")]
public sealed class AdminReviewsController(ISender sender) : BaseController
{
    [HttpGet("moderation_queue")]
    [ProducesOkApiResponseType<PagedResult<ModerationQueueItemDto>>]
    public async Task<IActionResult> ModerationQueue([FromQuery] GetReviewModerationQueueQuery query, CancellationToken cancellationToken)
        => OperationResult(await sender.Send(query, cancellationToken));
}
