// EN: Validators for Admin commands (approve, reject, suspend, reactivate, ban merchant).
// VI: Validators cho cac commands Admin (duyet, tu choi, tam dinh chi, kich hoat lai, cam merchant).

using FluentValidation;
using MerchantService.API.Application.Commands.Admin;

namespace MerchantService.API.Application.Validations;

/// <summary>
/// EN: Validator for ApproveMerchantCommand.
/// VI: Validator cho ApproveMerchantCommand.
/// </summary>
public class ApproveMerchantCommandValidator : AbstractValidator<ApproveMerchantCommand>
{
    public ApproveMerchantCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID la bat buoc");

        RuleFor(x => x.ApprovedBy)
            .NotEmpty()
            .WithMessage("Approver ID is required / ID nguoi duyet la bat buoc");
    }
}

/// <summary>
/// EN: Validator for RejectMerchantCommand.
/// VI: Validator cho RejectMerchantCommand.
/// </summary>
public class RejectMerchantCommandValidator : AbstractValidator<RejectMerchantCommand>
{
    public RejectMerchantCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID la bat buoc");

        RuleFor(x => x.Reason)
            .NotEmpty()
            .WithMessage("Rejection reason is required / Ly do tu choi la bat buoc")
            .MaximumLength(1000)
            .WithMessage("Rejection reason must not exceed 1000 characters / Ly do tu choi khong vuot qua 1000 ky tu");

        RuleFor(x => x.RejectedBy)
            .NotEmpty()
            .WithMessage("Rejector ID is required / ID nguoi tu choi la bat buoc");
    }
}

/// <summary>
/// EN: Validator for SuspendMerchantCommand.
/// VI: Validator cho SuspendMerchantCommand.
/// </summary>
public class SuspendMerchantCommandValidator : AbstractValidator<SuspendMerchantCommand>
{
    public SuspendMerchantCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID la bat buoc");

        RuleFor(x => x.Reason)
            .NotEmpty()
            .WithMessage("Suspension reason is required / Ly do tam dinh chi la bat buoc")
            .MaximumLength(1000)
            .WithMessage("Suspension reason must not exceed 1000 characters / Ly do tam dinh chi khong vuot qua 1000 ky tu");
    }
}

/// <summary>
/// EN: Validator for ReactivateMerchantCommand.
/// VI: Validator cho ReactivateMerchantCommand.
/// </summary>
public class ReactivateMerchantCommandValidator : AbstractValidator<ReactivateMerchantCommand>
{
    public ReactivateMerchantCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID la bat buoc");
    }
}

/// <summary>
/// EN: Validator for BanMerchantCommand.
/// VI: Validator cho BanMerchantCommand.
/// </summary>
public class BanMerchantCommandValidator : AbstractValidator<BanMerchantCommand>
{
    public BanMerchantCommandValidator()
    {
        RuleFor(x => x.MerchantId)
            .NotEmpty()
            .WithMessage("Merchant ID is required / Merchant ID la bat buoc");

        RuleFor(x => x.Reason)
            .NotEmpty()
            .WithMessage("Ban reason is required / Ly do cam la bat buoc")
            .MaximumLength(1000)
            .WithMessage("Ban reason must not exceed 1000 characters / Ly do cam khong vuot qua 1000 ky tu");
    }
}
