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

/// <summary>Whether the caller may review a booking, and if not, the stable machine reason so the CTA/form
/// can gate without probing the 1:1 <c>409</c>.</summary>
public record ReviewEligibilityDto(bool CanReview, string? Reason)
{
    public const string ReasonNotCompleted = "not_completed";
    public const string ReasonAlreadyReviewed = "already_reviewed";
    public const string ReasonNotOwner = "not_owner";
    public const string ReasonNotFound = "not_found";
}

/// <summary>The caller's own review for a booking (across sessions), so a returning customer sees the
/// persistent "under review" state and never a second form. <c>ModerationStatus</c> is <c>none</c> when the
/// customer has not reviewed the booking.</summary>
public record MyReviewDto(
    string ModerationStatus,
    int? Rating,
    string? Body,
    IReadOnlyList<string> TagCodes,
    DateTimeOffset? CreatedAt)
{
    public const string StatusNone = "none";
}

/// <summary>Owner-scoped envelope for the my-review read: the owning customer's user id (compared to the
/// caller) + the review. A foreign booking is a clean not-found.</summary>
public record MyReviewProjection(int CustomerUserId, MyReviewDto Review);
