using FluentValidation; using LittleShop.DTOs; namespace LittleShop.Validators; public class CreateProductDtoValidator : AbstractValidator { public CreateProductDtoValidator() { RuleFor(x => x.Name) .NotEmpty().WithMessage("Product name is required") .MaximumLength(200).WithMessage("Product name cannot exceed 200 characters"); RuleFor(x => x.Description) .NotEmpty().WithMessage("Product description is required"); RuleFor(x => x.Price) .GreaterThan(0).WithMessage("Price must be greater than 0"); RuleFor(x => x.Weight) .GreaterThan(0).WithMessage("Weight must be greater than 0"); RuleFor(x => x.CategoryId) .NotEmpty().WithMessage("Category is required"); } }