using Microsoft.EntityFrameworkCore;

namespace CockieAuthApp.Models.Data
{
    public class AuthContext : DbContext
    {
        public DbSet<User> Users { get; set; }
        public DbSet<Role> Roles { get; set; }

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

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Role>().HasData(new Role {Id = 1, Name = "admin"});
            modelBuilder.Entity<Role>().HasData(new Role {Id = 2, Name = "user"});
            modelBuilder.Entity<User>().HasData(new User {Id = "Admin", Email = "admin@admin.admin", Password = "root", RoleId = 1});
        }
    }
}