namespace Campaign_Tracker.Server.LegacyData.Schema;
///
/// Abstraction for reading the *current* legacy schema at runtime.
///
/// In production this is implemented against the live Access database (OleDb
/// schema rowsets). In development and testing it is implemented in-memory and
/// seeded from the baseline so the default state is "no drift". Tests inject
/// mutated inspectors to simulate drift.
///
public interface ILegacySchemaInspector
{
Task> GetCurrentSchemaAsync(
CancellationToken cancellationToken = default);
}
///
/// Default development/test inspector. Returns whatever table list it was
/// constructed with (defaulting to the baseline tables — no drift).
///
public sealed class InMemoryLegacySchemaInspector : ILegacySchemaInspector
{
private readonly IReadOnlyList _tables;
public InMemoryLegacySchemaInspector(IReadOnlyList tables)
{
_tables = tables ?? throw new ArgumentNullException(nameof(tables));
}
public Task> GetCurrentSchemaAsync(
CancellationToken cancellationToken = default) =>
Task.FromResult(_tables);
}