using Indotalent.Data.Entities;
using Microsoft.EntityFrameworkCore;

namespace Indotalent.Infrastructure.Database.Demo;

public static class WarehouseSeeder
{
    public static async Task GenerateDataAsync(AppDbContext context)
    {
        if (await context.Warehouse.Where(x => x.SystemWarehouse == false).AnyAsync()) return;

        var warehouses = new List<Warehouse>
        {
            new Warehouse { Name = "New York" },
            new Warehouse { Name = "San Francisco" },
            new Warehouse { Name = "Chicago" },
            new Warehouse { Name = "Los Angeles" }
        };

        foreach (var warehouse in warehouses)
        {
            await context.Warehouse.AddAsync(warehouse);
        }

        await context.SaveChangesAsync();
    }
}