import Foundation

/// A service that captures audio from a microphone for the Recording feature.
///
/// ``RecordingView`` attaches the service to its model at initialization, so the audio capture can be swapped without touching the feature's
/// state machine — for example, with a real microphone backend in the app, or with a mock in unit tests.
public protocol Capturing: Sendable {

    // MARK: Methods

    /// Starts a new audio recording from the microphone.
    func start() async throws

    /// Pauses the ongoing recording.
    func pause() async throws

    /// Resumes a paused recording.
    func resume() async throws

    /// Stops the recording.
    ///
    /// - Returns: The audio captured since the recording started.
    func stop() async throws -> Data

}
