using ClaudeDo.Data.Models;
using Microsoft.EntityFrameworkCore;

namespace ClaudeDo.Data.Seeding;

public static class DefaultListsSeeder
{
    private static readonly string[] Defaults = { "My Day", "Important", "Planned" };

    public static async Task SeedAsync(ClaudeDoDbContext ctx, CancellationToken ct = default)
    {
        var existing = await ctx.Lists.Select(l => l.Name).ToListAsync(ct);
        var now = DateTime.UtcNow;
        foreach (var name in Defaults.Where(n => !existing.Contains(n)))
        {
            ctx.Lists.Add(new ListEntity
            {
                Id = Guid.NewGuid().ToString("N"),
                Name = name,
                CreatedAt = now,
            });
        }
        await ctx.SaveChangesAsync(ct);
    }
}
