// EN: Validator for CompleteOrderPaymentCommand.
// VI: Validator cho CompleteOrderPaymentCommand.

using FluentValidation;
using OrderService.API.Application.Commands;

namespace OrderService.API.Application.Validations;

/// <summary>
/// EN: Validator for CompleteOrderPaymentCommand.
/// VI: Validator cho CompleteOrderPaymentCommand.
/// </summary>
public class CompleteOrderPaymentCommandValidator : AbstractValidator<CompleteOrderPaymentCommand>
{
    public CompleteOrderPaymentCommandValidator()
    {
        RuleFor(x => x.OrderId)
            .NotEmpty()
            .WithMessage("EN: Order ID is required / VI: Order ID la bat buoc");

        RuleFor(x => x.GatewayTransactionId)
            .NotEmpty()
            .WithMessage("EN: Gateway transaction ID is required / VI: Ma giao dich cong thanh toan la bat buoc")
            .MaximumLength(200)
            .WithMessage("EN: Gateway transaction ID must not exceed 200 characters / VI: Ma giao dich khong vuot qua 200 ky tu");

        RuleFor(x => x.GatewayResponseCode)
            .MaximumLength(50)
            .WithMessage("EN: Gateway response code must not exceed 50 characters / VI: Ma phan hoi khong vuot qua 50 ky tu")
            .When(x => x.GatewayResponseCode != null);
    }
}
