using FluentValidation;
using AdsBillingService.API.Application.Commands;

namespace AdsBillingService.API.Application.Validations;

/// <summary>
/// EN: Validator for CreateBillingAccountCommand.
/// VI: Validator cho CreateBillingAccountCommand.
/// </summary>
public class CreateBillingAccountCommandValidator : AbstractValidator<CreateBillingAccountCommand>
{
    private static readonly string[] ValidPaymentMethods = ["prepaid", "postpaid"];

    public CreateBillingAccountCommandValidator()
    {
        RuleFor(x => x.AdvertiserId)
            .NotEmpty()
            .WithMessage("Advertiser ID is required / Advertiser ID là bắt buộc");

        RuleFor(x => x.PaymentMethod)
            .NotEmpty()
            .WithMessage("Payment method is required / Phương thức thanh toán là bắt buộc")
            .Must(pm => ValidPaymentMethods.Contains(pm))
            .WithMessage("Payment method must be 'prepaid' or 'postpaid' / Phương thức thanh toán phải là 'prepaid' hoặc 'postpaid'");
    }
}
