using Journal.Core.Dtos;

namespace Journal.Core.Services.Speech;

public sealed class DisabledSpeechBridgeService(string provider = "none", string message = "Speech bridge is disabled.") : ISpeechBridgeService
{
    private readonly string _provider = string.IsNullOrWhiteSpace(provider) ? "none" : provider.Trim();
    private readonly string _message = string.IsNullOrWhiteSpace(message) ? "Speech bridge is disabled." : message.Trim();

    public Task<SpeechDevicesResultDto> ListDevicesAsync(CancellationToken cancellationToken = default)
    {
        var warning = $"{_message} (provider={_provider})";
        return Task.FromResult(new SpeechDevicesResultDto([], warning));
    }

    public Task<SpeechTranscribeResultDto> TranscribeAsync(
        SpeechTranscribeRequestDto request,
        CancellationToken cancellationToken = default)
    {
        ArgumentNullException.ThrowIfNull(request);
        var engine = string.IsNullOrWhiteSpace(request.Engine) ? "none" : request.Engine.Trim();
        var warning = $"{_message} (provider={_provider})";
        return Task.FromResult(new SpeechTranscribeResultDto("", engine, warning));
    }
}
