using Exam.Infrastructure.Extensions;
using FluentValidation;
using Hotline.Share.Dtos.TestPapers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hotline.Exams.Validate;

namespace Hotline.Validators.Exams.ExamManages
{
    public class AddExtractRuleDtoValidator:AbstractValidator<AddExtractRuleDto>
    {
        public AddExtractRuleDtoValidator()
        {
            RuleFor(m => m.Name).NotEmpty().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired,x.GetType().GetDescription(nameof(ExtractRuleDto.Name))));
            RuleFor(m => m.RuleType).NotNull().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.RuleType))));

            RuleForEach(m => m.TagQuestionDtos).SetValidator(new AddTagQuestionDtoValidator());

            RuleForEach(m => m.RuleTagDtos).SetValidator(new AddRuleTagDtoValidator());
        }
    }
}
