using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.EntityFrameworkCore;

namespace DigitalData.UserManager.Infrastructure.Repositories
{
    public class UserManagerDbContext : DbContext, IUserManagerDbContext
    {
        public DbSet<GroupOfUser> GroupOfUsers { get; set; }

        public DbSet<Group> Groups { get; set; }

        public DbSet<ModuleOfUser> ModuleOfUsers { get; set; }

        public DbSet<Module> Modules { get; set; }

        public DbSet<User> Users { get; set; }

        public DbSet<UserRep> UserReps { get; set; }

        public UserManagerDbContext(DbContextOptions<UserManagerDbContext> options) : base(options)
        {
            GroupOfUsers = Set<GroupOfUser>();
            Groups = Set<Group>();
            ModuleOfUsers = Set<ModuleOfUser>();
            Modules = Set<Module>();
            Users = Set<User>();
            UserReps = Set<UserRep>();
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ConfigureUserManager();
            base.OnModelCreating(modelBuilder);
        }
    }
}