using System.ComponentModel.DataAnnotations; using Asp.Versioning; using Baya.Application.Features.Refunds.Queries.GetRefundByBooking; using Baya.Application.Features.Refunds.Queries.GetRefundStatus; using Baya.Application.Models.Refunds; using Baya.WebFramework.Attributes; using Baya.WebFramework.BaseController; using Mediator; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Baya.Web.Api.Controllers.V1; /// The customer-facing refund status — the only customer-visible refund surface (there is no /// self-service refund initiation). Tenancy-scoped: a customer sees only their own refund. [ApiVersion("1")] [ApiController] [Route("api/v{version:apiVersion}/refunds")] [Authorize] [Display(Description = "Customer refund status")] public sealed class RefundsController(ISender sender) : BaseController { [HttpGet("{id}/status")] [ProducesOkApiResponseType] public async Task Status(long id, CancellationToken cancellationToken) => OperationResult(await sender.Send(new GetRefundStatusQuery(id), cancellationToken)); // Reach the refund from its booking id (the id the customer holds) — 404 when none exists (REQ-021). [HttpGet("by_booking/{bookingId}")] [ProducesOkApiResponseType] public async Task ByBooking(long bookingId, CancellationToken cancellationToken) => OperationResult(await sender.Send(new GetRefundByBookingQuery(bookingId), cancellationToken)); }