using FluentValidation;
using PromotionService.API.Application.Commands;

namespace PromotionService.API.Application.Validations;

/// <summary>
/// EN: Validator for RedeemVoucherCommand.
/// VI: Validator cho RedeemVoucherCommand.
/// </summary>
public class RedeemVoucherCommandValidator : AbstractValidator<RedeemVoucherCommand>
{
    public RedeemVoucherCommandValidator()
    {
        RuleFor(x => x.VoucherCode)
            .NotEmpty().WithMessage("Voucher code is required / Mã voucher là bắt buộc")
            .MaximumLength(50).WithMessage("Voucher code max 50 chars / Mã voucher tối đa 50 ký tự");

        RuleFor(x => x.UserId)
            .NotEmpty().WithMessage("User ID is required / ID người dùng là bắt buộc");

        RuleFor(x => x.OrderAmount)
            .GreaterThan(0).WithMessage("Order amount must be positive / Số tiền đơn hàng phải dương");
    }
}
