using CalledIt.Domain.Dtos;
using FluentValidation;

namespace CalledIt.Domain.Validators;

public class CreateMatchDtoValidator : AbstractValidator<CreateMatchDto>
{
    public CreateMatchDtoValidator()
    {
        RuleFor(x => x.CompetitionId).GreaterThan(0);
        RuleFor(x => x.HomeTeamId).GreaterThan(0);
        RuleFor(x => x.AwayTeamId).GreaterThan(0);
        RuleFor(x => x.AwayTeamId)
            .NotEqual(x => x.HomeTeamId)
            .WithMessage("Home team and away team must be different.");
        RuleFor(x => x.Round).NotEmpty();
    }
}
