using FluentValidation;
using SportsDivision.Application.DTOs;

namespace SportsDivision.Application.Validators;

public class StudentCreateValidator : AbstractValidator<StudentCreateDto>
{
    public StudentCreateValidator()
    {
        RuleFor(x => x.FirstName).NotEmpty().MaximumLength(100);
        RuleFor(x => x.LastName).NotEmpty().MaximumLength(100);
        RuleFor(x => x.DateOfBirth).NotEmpty()
            .LessThan(DateOnly.FromDateTime(DateTime.Today)).WithMessage("Date of birth must be in the past.");
        RuleFor(x => x.Sex).IsInEnum();
        RuleFor(x => x.SchoolId).GreaterThan(0);
        RuleFor(x => x.ExistingStudentId).MaximumLength(50);
    }
}
