using FluentValidation;
using OnlineAssessment.Domain.ViewModels;

namespace OnlineAssessment.Validators
{
    public class QuestionAddModelValidator : AbstractValidator<QuestionAddModel>
    {
        public QuestionAddModelValidator()
        {
                
            RuleFor(q => q.title)
                .NotEmpty()
                .NotNull()
                .MaximumLength(2500);

            RuleFor(q => q.status)
                .NotEmpty()
                .NotNull()
                .MaximumLength(10);

            RuleFor(q => q.complexity_code)
                .NotNull()
                .LessThanOrEqualTo(5);

        }
    }

    public class QuestionEditModelValidator : AbstractValidator<QuestionEditModel>
    {
        public QuestionEditModelValidator()
        {
            RuleFor(q => q.id)
               .NotEmpty()
               .NotNull()
               .GreaterThan(0);

            RuleFor(q => q.title)
                .MaximumLength(2500);

 
            RuleFor(q => q.complexity_code)
                .LessThanOrEqualTo(3);

        }
    }
}
