using ClaudeDo.Data;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.Services.Interfaces;
using Microsoft.EntityFrameworkCore;

namespace ClaudeDo.Ui.Tests;

/// <summary>
/// The test doubles every ViewModel test needs. They used to be redeclared as a private nested
/// class in each test file (TestDbFactory alone in 40 of them) — put new shared no-op doubles here
/// rather than copying one again. Test-specific behaviour still belongs in the test file.
/// </summary>
public sealed class TestDbFactory(Func<ClaudeDoDbContext> create) : IDbContextFactory<ClaudeDoDbContext>
{
    public ClaudeDoDbContext CreateDbContext() => create();
}

public sealed class NullServiceProvider : IServiceProvider
{
    public object? GetService(Type serviceType) => null;
}

public sealed class StubNotesApi : INotesApi
{
    public Task<List<DailyNoteDto>> ListAsync(DateOnly day) => Task.FromResult(new List<DailyNoteDto>());
    public Task<List<DailyNoteDto>> ListBetweenAsync(DateOnly start, DateOnly end) => Task.FromResult(new List<DailyNoteDto>());
    public Task<DailyNoteDto?> AddAsync(DateOnly day, string text) => Task.FromResult<DailyNoteDto?>(null);
    public Task UpdateAsync(string id, string text) => Task.CompletedTask;
    public Task DeleteAsync(string id) => Task.CompletedTask;
}

/// <summary><see cref="StubWorkerClient"/> is abstract — this is the concrete no-op subclass.</summary>
public sealed class DefaultStub : StubWorkerClient { }
