#nullable enable
using Baya.Application.Models.Common;
using Baya.Application.Models.SupportAlerts;

namespace Baya.Application.Contracts.SupportAlerts;

/// <summary>
/// Internal support-alert worklist. <see cref="RaiseAsync"/> is called by later review/EVV/verification/
/// payment flows. Alerts are staff-only — never surfaced on a user-facing endpoint. The polymorphic
/// <c>(entityType, entityId)</c> is validated at the application layer; the typed FK is preferred when
/// the subject is a booking or review.
/// </summary>
public interface ISupportAlertService
{
    ValueTask<long> RaiseAsync(
        string type,
        string entityType,
        string entityId,
        string severity,
        long? bookingId = null,
        long? reviewId = null,
        CancellationToken cancellationToken = default);

    /// <summary>Assigns an open alert to an owner (open → assigned). Returns <c>false</c> if the alert is missing or already resolved.</summary>
    ValueTask<bool> AssignAsync(long alertId, int ownerUserId, CancellationToken cancellationToken = default);

    /// <summary>Resolves an alert with a note (→ resolved). Returns <c>false</c> if the alert is missing or already resolved.</summary>
    ValueTask<bool> ResolveAsync(long alertId, string note, CancellationToken cancellationToken = default);

    ValueTask<PagedResult<SupportAlertDto>> ListAsync(
        string? type,
        string? status,
        int? ownerUserId,
        int page,
        int pageSize,
        CancellationToken cancellationToken = default);
}
