using Baya.Application.Models.Common;
using Baya.Application.Models.Jwt;
using Baya.SharedKernel.ValidationBase;
using Baya.SharedKernel.ValidationBase.Contracts;
using FluentValidation;
using Mediator;

namespace Baya.Application.Features.Users.Commands.RefreshUserTokenCommand;

public record RefreshUserTokenCommand(Guid RefreshToken) : IRequest<OperationResult<AccessToken>>,
    IValidatableModel<RefreshUserTokenCommand>
{
    public IValidator<RefreshUserTokenCommand> ValidateApplicationModel(ApplicationBaseValidationModelProvider<RefreshUserTokenCommand> validator)
    {
        validator.RuleFor(c => c.RefreshToken)
            .NotEmpty()
            .NotNull()
            .WithMessage("Please enter valid user refresh token");

        return validator;
    }
};