using FluentValidation;
using MktXService.API.Application.Commands;

namespace MktXService.API.Application.Validations;

/// <summary>
/// EN: Validator for ConnectTwitterAccountCommand.
/// VI: Validator cho ConnectTwitterAccountCommand.
/// </summary>
public class ConnectTwitterAccountCommandValidator : AbstractValidator<ConnectTwitterAccountCommand>
{
    public ConnectTwitterAccountCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID là bắt buộc");

        RuleFor(x => x.TwitterUserId)
            .NotEmpty()
            .WithMessage("Twitter User ID is required / Twitter User ID là bắt buộc");

        RuleFor(x => x.Username)
            .NotEmpty()
            .WithMessage("Username is required / Username là bắt buộc")
            .MaximumLength(50)
            .WithMessage("Username must be less than 50 characters / Username phải ít hơn 50 ký tự");

        RuleFor(x => x.OAuthToken)
            .NotEmpty()
            .WithMessage("OAuth Token is required / OAuth Token là bắt buộc");

        RuleFor(x => x.OAuthTokenSecret)
            .NotEmpty()
            .WithMessage("OAuth Token Secret is required / OAuth Token Secret là bắt buộc");
    }
}

/// <summary>
/// EN: Validator for DisconnectTwitterAccountCommand.
/// VI: Validator cho DisconnectTwitterAccountCommand.
/// </summary>
public class DisconnectTwitterAccountCommandValidator : AbstractValidator<DisconnectTwitterAccountCommand>
{
    public DisconnectTwitterAccountCommandValidator()
    {
        RuleFor(x => x.AccountId)
            .NotEmpty()
            .WithMessage("Account ID is required / Account ID là bắt buộc");
    }
}

/// <summary>
/// EN: Validator for RefreshTwitterAccountTokensCommand.
/// VI: Validator cho RefreshTwitterAccountTokensCommand.
/// </summary>
public class RefreshTwitterAccountTokensCommandValidator : AbstractValidator<RefreshTwitterAccountTokensCommand>
{
    public RefreshTwitterAccountTokensCommandValidator()
    {
        RuleFor(x => x.AccountId)
            .NotEmpty()
            .WithMessage("Account ID is required / Account ID là bắt buộc");

        RuleFor(x => x.NewOAuthToken)
            .NotEmpty()
            .WithMessage("New OAuth Token is required / OAuth Token mới là bắt buộc");

        RuleFor(x => x.NewOAuthTokenSecret)
            .NotEmpty()
            .WithMessage("New OAuth Token Secret is required / OAuth Token Secret mới là bắt buộc");
    }
}
