#nullable enable
namespace Baya.Application.Contracts.Reviews;

/// <summary>The AI/automated pre-screen decision for a submitted review.</summary>
public enum ModerationDecision
{
    /// <summary>Clean text — safe to auto-publish (subject to the auto-approve config).</summary>
    Approve,

    /// <summary>Suspicious — keep <c>pending_moderation</c> for a human to decide.</summary>
    Flag,

    /// <summary>Clearly disallowed — a human can still override, but the pre-screen recommends rejecting.</summary>
    Reject
}

/// <summary>The verdict a pre-screen returns: the decision plus a short machine reason.</summary>
/// <param name="Decision">The recommended disposition.</param>
/// <param name="Reason">A short reason code/text (e.g. <c>clean</c>, <c>banned_word:scam</c>).</param>
public sealed record ModerationVerdict(ModerationDecision Decision, string Reason);

/// <summary>
/// Seam for automated review moderation (introduced backend-phase-14). The mock is a keyword filter /
/// pass-through with no external call; a real text classifier / LLM endpoint swaps in by a registration
/// change only — <c>ModerateReviewCommand</c> keeps decision authority and always allows a human override, so
/// the real implementation never needs to touch the handler.
/// </summary>
public interface IReviewModerationService
{
    ValueTask<ModerationVerdict> ScreenAsync(string? reviewText, CancellationToken cancellationToken = default);
}
