using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using CMSMicroservice.Domain.Entities;
using CMSMicroservice.Domain.Enums;
using CMSMicroservice.Infrastructure.Persistence;

namespace CMSMicroservice.Infrastructure.Data.Seeding;

/// <summary>
/// Seeder for migrating existing User.ParentId to User.NetworkParentId
/// NOTE: ParentId has been removed from User entity, so this seeder is now obsolete
/// </summary>
public class NetworkParentIdMigrationSeeder
{
    private readonly ApplicationDbContext _context;
    private readonly ILogger<NetworkParentIdMigrationSeeder> _logger;

    public NetworkParentIdMigrationSeeder(
        ApplicationDbContext context, 
        ILogger<NetworkParentIdMigrationSeeder> logger)
    {
        _context = context;
        _logger = logger;
    }

    public async Task SeedAsync(CancellationToken cancellationToken = default)
    {
        _logger.LogInformation("=== NetworkParentIdMigrationSeeder: ParentId Removed ===");
        
        // ParentId has been removed from User entity
        // This seeder is no longer necessary
        _logger.LogInformation("ParentId field has been removed. Migration is obsolete.");
        
        await Task.CompletedTask;
    }
}
