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

namespace Indotalent.Infrastructure.Database.Demo;

public static class VendorGroupSeeder
{
    public static async Task GenerateDataAsync(AppDbContext context)
    {
        if (await context.VendorGroup.AnyAsync()) return;

        var vendorGroups = new List<VendorGroup>
        {
            new VendorGroup { Name = "Manufacture" },
            new VendorGroup { Name = "Supplier" },
            new VendorGroup { Name = "Service Provider" },
            new VendorGroup { Name = "Distributor" },
            new VendorGroup { Name = "Freelancer" }
        };

        foreach (var group in vendorGroups)
        {
            await context.VendorGroup.AddAsync(group);
        }

        await context.SaveChangesAsync();
    }
}