using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using phronCare.API.Models.Security;

namespace phronCare.API.Models
{
    public class phronCareDbContext : IdentityDbContext<ApplicationUser>
    {
        public phronCareDbContext(DbContextOptions<phronCareDbContext> options) : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
            //SeedRoles(builder);
        }

        private static void SeedRoles(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<IdentityRole>().HasData
            (
                new IdentityRole() { Name = "Administrator", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "administrator" },
                new IdentityRole() { Name = "User", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "user" }
            );
        }
    }
}




//using Microsoft.AspNetCore.Identity;
//using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
//using Microsoft.EntityFrameworkCore;

//namespace phronCare.API.Models
//{
//    public class phronCareDbContext: IdentityDbContext<IdentityUser>
//    {
//        public phronCareDbContext(DbContextOptions<phronCareDbContext> options):base(options)
//        {
//        }
//        protected override void OnModelCreating(ModelBuilder builder)
//        {
//            base.OnModelCreating(builder);
//            //SeedRoles(builder);
//        }
//        private static void SeedRoles(ModelBuilder modelBuilder)
//        {
//            modelBuilder.Entity<IdentityRole>().HasData
//                (
//                new IdentityRole() { Name = "Administrator", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "administrator" },
//                new IdentityRole() { Name = "User", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "user" }
//                );
//        }
//    }
//}
