import Foundation

/// The recording service used for development, which simulates the audio capture without touching a microphone.
///
/// The service is internal on purpose: it only backs the feature's previews and the default values of its model, and is not part of the
/// package's public interface.
struct DummyCapturing: Capturing {

    // MARK: Methods

    /// Simulates the start of an audio recording.
    func start() async throws {}

    /// Simulates the pause of an ongoing recording.
    func pause() async throws {}

    /// Simulates the resumption of a paused recording.
    func resume() async throws {}

    /// Simulates the stop of a recording.
    ///
    /// - Returns: The location of a dummy audio file, which is never actually created.
    func stop() async throws -> URL {
        FileManager.default.temporaryDirectory.appending(path: Constant.File.name)
    }

}

// MARK: - Constants

/// The constant values used across the recording services.
private enum Constant {
    /// The file constants.
    enum File {
        /// The name of the dummy audio file.
        static let name = "dummy.m4a"
    }
}
