using FluentValidation;

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

public sealed class UpdateServiceOptionGroupCommandValidator : AbstractValidator<UpdateServiceOptionGroupCommand>
{
    // Id is supplied by the route (set after model binding), so it is not validated here.
    public UpdateServiceOptionGroupCommandValidator()
    {
        RuleFor(x => x.NameFa).NotEmpty().MaximumLength(150);
        RuleFor(x => x.NameEn).NotEmpty().MaximumLength(150);
        RuleFor(x => x.ServiceCategoryId).GreaterThan(0).When(x => x.ServiceCategoryId.HasValue);
    }
}
