using Domain;
using Domain.Weapons;

namespace DataLayer;

public static class DbContextInitializer
{
    public static void Initialize(DeathwatchDbContext context)
    {
        context.Database.EnsureCreated();

        // Look for any students.
        if (context.Players.Any()) return; // DB has been seeded

        var weapon = new Weapon
        {
            At = "test",
            Range = 30,
            Attribute = "CT",
            Type = "RANGE"
        };

        var players = new[]
        {
            new Player
            {
                Experience = 17400,
                CC = 52,
                CT = 40,
                F = 46,
                E = 45,
                AG = 50,
                INT = 34,
                PER = 43,
                FM = 43,
                SOC = 40,
                Weapons = new List<Weapon> { weapon }
            }
        };
        foreach (var player in players) context.Players.Add(player);
        context.SaveChanges();
    }
}