using Femto.Common.Domain;
using Femto.Modules.Auth.Data;
using Femto.Modules.Auth.Models;

namespace Femto.Modules.Auth.Application.Interface.CreateSignupCode;

internal class CreateSignupCodeCommandHandler(AuthContext context) : ICommandHandler<CreateSignupCodeCommand>
{
    public async Task Handle(CreateSignupCodeCommand command, CancellationToken cancellationToken)
    {
        var code = new SignupCode(command.RecipientEmail, command.RecipientName, command.Code);
        
        await context.SignupCodes.AddAsync(code, cancellationToken);
    }
}
