using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Kimuser.Data.EntityMapping;
using Kimuser.Data.EntityMapping.IdentityCore;
using Kimuser.Data.EntityMapping.Users;
using Kimuser.Domain;
using Kimuser.Domain.SystemUsers;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Kimuser.Data
{
    public class KimuserDbContext : IdentityDbContext<User,Role,int>
    {
       

        public KimuserDbContext(DbContextOptions options) : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
            // Customize the ASP.NET Identity model and override the defaults if needed.
            // For example, you can rename the ASP.NET Identity table names and more.
            // Add your customizations after calling base.OnModelCreating(builder);
            //builder.Entity<User>().ToTable("User");
            //builder.Entity<Role>().ToTable("Role");
            //builder.Entity<IdentityUserRole<int>>().ToTable("UserRole");
            //builder.Entity<IdentityUserClaim<int>>().ToTable("UserClaim");
            //builder.Entity<IdentityUserLogin<int>>().ToTable("UserLogin");
            //builder.Entity<IdentityRoleClaim<int>>().ToTable("RoleClaim");
            //builder.Entity<IdentityUserToken<int>>().ToTable("UserToken");

            builder
                .RegisterEntityMapping<SystemUser, SystemUserMap>()


            #region Identity

                .RegisterEntityMapping<User, UserMap>()
                .RegisterEntityMapping<Role, RoleMap>()
                .RegisterEntityMapping<IdentityUserClaim<int>, IdentityUserClaimMap>()
                .RegisterEntityMapping<IdentityRoleClaim<int>, IdentityRoleClaimMap>()
                .RegisterEntityMapping<IdentityUserRole<int>, IdentityUserRoleMap>()
                .RegisterEntityMapping<IdentityUserLogin<int>, IdentityUserLoginMap>()
                .RegisterEntityMapping<IdentityUserToken<int>, IdentityUserTokenMap>()

            #endregion

                ;

        }

        

    }
}
