using Application.Abstractions.Messaging;
using Application.Abstractions.Identity;
using Application.Abstractions.Identity.Models;

namespace Application.Features.Director.User.Update
{
    public sealed class Handler(IIdentityUserWriter userWriter) : ICommandHandler<Command>
    {
        public async Task Handle(Command request, CancellationToken ct)
        {
            await userWriter.UpdateUserAsync(new ApplicationUserDto
            {
                ID = request.ID,
                Name = request.FullName,
                Email = request.Email,
                Phone = request.PhoneNumber,
                NewPassword = request.NewPassword,
                ConfirmPassword = request.ConfirmPassword,
                IsDeleted = request.IsDeleted,
                EmailConfirmed = request.EmailConfirmed,
                LockoutEnd = request.LockoutEnd,
            }, ct);
        }
    }
}