using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;

namespace AsbCloudDb.Model.DefaultData
{
    public static class DefaultContextData
    {
        public static Dictionary<Type, IEntityFiller> GetFillers()
        {
            var fillers = new Dictionary<Type, IEntityFiller>
            {
                // Order does meter
                { typeof(UserRole),  new EntityFillerUserRole() },
                { typeof(RelationUserRoleUserRole),  new EntityFillerRelationUserRoleUserRole()},
                { typeof(Permission),  new EntityFillerPermission()},
                { typeof(RelationUserRolePermission),  new EntityFillerRelationUserRolePermission()},
                { typeof(User),  new EntityFillerUser()},
                { typeof(RelationUserUserRole),  new EntityFillerRelationUserUserRole()},
                { typeof(Company),  new EntityFillerCompany()},
                { typeof(WellOperationCategory),  new EntityFillerWellOperationCategory()},
                { typeof(FileCategory),  new EntityFillerFileCategory()},
                { typeof(WellSectionType),  new EntityFillerWellSectionType()},
                { typeof(WellType),  new EntityFillerWellType()},
                { typeof(MeasureCategory),  new EntityFillerMeasureCategory()},
                { typeof(CompanyType),  new EntityFillerCompanyType()},
                { typeof(Subsystem),  new EntityFillerSubsystem() },
                { typeof(NotificationCategory), new EntityNotificationCategory()},
            };
            return fillers;
        }

        public static void Fill(ModelBuilder modelBuilder)
        {
            var fillers = GetFillers();

            foreach (var filler in fillers.Values)
                filler.FillData(modelBuilder);
        }
    }
}