using FluentValidation;
using MembershipService.API.Application.Commands;

namespace MembershipService.API.Application.Validations;

/// <summary>
/// EN: Validator for CreateStampCardCommand.
/// VI: Validator cho CreateStampCardCommand.
/// </summary>
public class CreateStampCardCommandValidator : AbstractValidator<CreateStampCardCommand>
{
    public CreateStampCardCommandValidator()
    {
        RuleFor(x => x.ShopId)
            .NotEmpty()
            .WithMessage("ShopId is required / ShopId la bat buoc");

        RuleFor(x => x.MemberId)
            .NotEmpty()
            .WithMessage("MemberId is required / MemberId la bat buoc");

        RuleFor(x => x.CardName)
            .NotEmpty()
            .WithMessage("Card name is required / Ten card la bat buoc")
            .MaximumLength(200)
            .WithMessage("Card name must not exceed 200 characters / Ten card khong duoc vuot qua 200 ky tu");

        RuleFor(x => x.TotalStampsRequired)
            .GreaterThanOrEqualTo(1)
            .WithMessage("Total stamps required must be at least 1 / Tong stamp can it nhat la 1")
            .LessThanOrEqualTo(100)
            .WithMessage("Total stamps required must not exceed 100 / Tong stamp can khong duoc vuot qua 100");
    }
}
