using Microsoft.EntityFrameworkCore;
using ServerManagement.Models;

namespace ServerManagement.Data;

public class ServerManagementContext : DbContext
{
  public DbSet<Server> Servers  { get; set; }

  public ServerManagementContext(DbContextOptions options): base(options) { }
  protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
    base.OnModelCreating(modelBuilder);

    modelBuilder.Entity<Server>().HasData(
      new Server {  Id = 1, Name = "Server1", City = "Eindhoven", IsOnline = true},
      new Server {  Id = 2, Name = "Server2", City = "Eindhoven", IsOnline = true },
      new Server {  Id = 3, Name = "Server3", City = "Eindhoven", IsOnline = false },
      new Server {  Id = 4, Name = "Server4", City = "Eindhoven", IsOnline = true },
      new Server {  Id = 5, Name = "Server5", City = "Helmond", IsOnline = true },
      new Server {  Id = 6, Name = "Server6", City = "Helmond", IsOnline = false },
      new Server {  Id = 7, Name = "Server7", City = "Helmond", IsOnline = true },
      new Server {  Id = 8, Name = "Server8", City = "Oosterhout", IsOnline = true },
      new Server {  Id = 9, Name = "Server9", City = "Oosterhout", IsOnline = true },
      new Server {  Id = 10, Name = "Server10", City = "Roosendaal", IsOnline = false },
      new Server {  Id = 11, Name = "Server11", City = "Roosendaal", IsOnline = false },
      new Server {  Id = 12, Name = "Server12", City = "Deurne", IsOnline = false },
      new Server {  Id = 13, Name = "Server13", City = "Deurne", IsOnline = true }
    );
  }
}
