using Exam.Infrastructure.Extensions;
using FluentValidation;
using Hotline.Exams.Validate;
using Hotline.Share.Dtos.TestPapers;

namespace Hotline.Validators.Exams.ExamManages
{
    public class UpdateExtractRuleDtoValidator:AbstractValidator<UpdateExtractRuleDto>
    {
        public UpdateExtractRuleDtoValidator()
        {

            //RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.Id))));

            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 UpdateTagQuestionDtoValidator());

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