using FluentValidation;
using GreenTree.Nachtragsmanagement.Web.Models.Admin.User;
using GreenTree.Nachtragsmanagement.Web.Models.Appendix;
using GreenTree.Nachtragsmanagement.Web.Models.Config;
using GreenTree.Nachtragsmanagement.Web.Models.Deviation;
using GreenTree.Nachtragsmanagement.Web.Models.Misc;
using GreenTree.Nachtragsmanagement.Web.Models.Site;
using GreenTree.Nachtragsmanagement.Web.Validation.Admin.User;
using GreenTree.Nachtragsmanagement.Web.Validation.Appendix;
using GreenTree.Nachtragsmanagement.Web.Validation.Config;
using GreenTree.Nachtragsmanagement.Web.Validation.Deviation;
using GreenTree.Nachtragsmanagement.Web.Validation.Misc;
using GreenTree.Nachtragsmanagement.Web.Validation.Site;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GreenTree.Nachtragsmanagement.Web.Validation
{
    public class AppendixValidatorFactory : ValidatorFactoryBase
    {
        private static Dictionary<Type, IValidator> validators = new Dictionary<Type, IValidator>();

        static AppendixValidatorFactory()
        {
            validators.Add(typeof(IValidator<UserDataModel>), new UserDataModelValidator());
            validators.Add(typeof(IValidator<RoleDataModel>), new RoleDataModelValidator());
            validators.Add(typeof(IValidator<DeviationDataModel>), new DeviationDataModelValidator());
            validators.Add(typeof(IValidator<StatusDataModel>), new StatusDataModelValidator());
            validators.Add(typeof(IValidator<DisturbanceDataModel>), new DisturbanceDataModelValidator());
            validators.Add(typeof(IValidator<KindDataModel>), new KindDataModelValidator());
            validators.Add(typeof(IValidator<AppendixDataModel>), new AppendixDataModelValidator());
            validators.Add(typeof(IValidator<InvoiceDataModel>), new InvoiceDataModelValidator());
            validators.Add(typeof(IValidator<StateDataModel>), new StateDataModelValidator());
            validators.Add(typeof(IValidator<CategoryDataModel>), new CategoryDataModelValidator());
            validators.Add(typeof(IValidator<SiteDataModel>), new SiteDataModelValidator());
            validators.Add(typeof(IValidator<MailNotificationDataModel>), new MailNotificationDataModelValidator());
            validators.Add(typeof(IValidator<HelpPageDataModel>), new HelpPageDataModelValidator());
            validators.Add(typeof(IValidator<ConfigItemDataModel>), new ConfigItemDataModelValidator());
        }

        public override IValidator CreateInstance(Type validatorType)
        {
            IValidator validator;
            if (validators.TryGetValue(validatorType, out validator))
            {
                return validator;
            }
            return validator;
        }
    }
}