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

using FluentValidation;

namespace FnbEngine.API.Application.Validations;

/// <summary>
/// EN: Validator for CreateTableCommand.
/// VI: Validator cho CreateTableCommand.
/// </summary>
public class CreateTableValidator : AbstractValidator<Commands.CreateTableCommand>
{
    public CreateTableValidator()
    {
        RuleFor(x => x.ShopId)
            .NotEmpty().WithMessage("Shop ID is required");

        RuleFor(x => x.TableNumber)
            .NotEmpty().WithMessage("Table number is required")
            .MaximumLength(20).WithMessage("Table number must not exceed 20 characters");

        RuleFor(x => x.Capacity)
            .GreaterThan(0).WithMessage("Capacity must be greater than zero");

        RuleFor(x => x.Zone)
            .MaximumLength(100).WithMessage("Zone must not exceed 100 characters")
            .When(x => x.Zone != null);
    }
}
