using ROLAC.API.DTOs.Invitations;
using ROLAC.API.Entities;
namespace ROLAC.API.Services;
public interface IInvitationService
{
///
/// Generates a single-use, 7-day invitation link for a member. Auto-creates the member's
/// login account (no password) when none exists, and revokes any prior unused invitation for
/// that account. Returns the raw token (shown once) and its expiry.
/// Throws when the member is missing or has no email.
///
Task CreateAsync(CreateInvitationRequest request);
/// Checks whether a raw token is still usable, without mutating it.
Task ValidateAsync(string rawToken);
///
/// Consumes an invitation: validates the token, sets the account password (enforcing the
/// Identity policy), and marks the invitation used. Returns the account on success, or an
/// error message describing why it failed (invalid/expired/used token or a policy violation).
///
Task<(AppUser? User, string? Error)> AcceptAsync(string rawToken, string newPassword);
/// E-mails an already-generated invitation link to the member via IEmailService.
Task SendEmailAsync(int memberId, string link);
}