using FluentValidation;

namespace Baya.Application.Features.Catalog.Commands.CreateServiceOptionGroup;

public sealed class CreateServiceOptionGroupCommandValidator : AbstractValidator<CreateServiceOptionGroupCommand>
{
    public CreateServiceOptionGroupCommandValidator()
    {
        RuleFor(x => x.NameFa).NotEmpty().MaximumLength(150);
        RuleFor(x => x.NameEn).NotEmpty().MaximumLength(150);
        // Null is the deliberate cross-category case; only a supplied id must be positive.
        RuleFor(x => x.ServiceCategoryId).GreaterThan(0).When(x => x.ServiceCategoryId.HasValue);
    }
}
