using Exam.Infrastructure.Extensions;
using Exam.Infrastructure.Validation.Validation;
using FluentValidation;
using Hotline.Exams.Validate;
using XF.Domain.Repository;

namespace Hotline.Repository.SqlSugar.Exam.Validate
{
    public class BaseValidator<T> : AbstractValidator<T> where T : CreationEntity
    {

        protected virtual void ValidateRuleWithModify()
        {
        }

        protected virtual void ValidateRuleWithAdd()
        {
        }

        protected virtual void BaseValidateRule()
        {
            RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.Id))));
            //RuleFor(m => m.CreatorId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.CreatorId))));
            //RuleFor(m => m.CreatorName).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.CreatorName))));
            //RuleFor(m => m.CreatorOrgId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.CreatorOrgId))));
            //RuleFor(m => m.CreatorOrgLevel).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.CreatorOrgLevel))));
            //RuleFor(m => m.CreatorOrgName).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(CreationEntity.CreatorOrgName))));
        }
    }
}
