/*
 * Copyright (c) 2025 Element Creations Ltd.
 * Copyright 2025 New Vector Ltd.
 *
 * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
 * Please see LICENSE files in the repository root for full details.
 */

package id.databisnis.android.bachot.features.messages.test.timeline.voicemessages.composer

import id.databisnis.android.bachot.features.messages.impl.voicemessages.composer.DefaultVoiceMessageComposerPresenter
import id.databisnis.android.bachot.features.messages.impl.voicemessages.composer.VoiceMessageComposerPlayer
import id.databisnis.android.bachot.features.messages.test.FakeMessageComposerContext
import id.databisnis.android.bachot.libraries.matrix.api.timeline.Timeline
import id.databisnis.android.bachot.libraries.matrix.test.room.FakeJoinedRoom
import id.databisnis.android.bachot.libraries.mediaplayer.test.FakeMediaPlayer
import id.databisnis.android.bachot.libraries.mediaupload.api.MediaSender
import id.databisnis.android.bachot.libraries.mediaupload.impl.DefaultMediaSender
import id.databisnis.android.bachot.libraries.mediaupload.test.FakeMediaOptimizationConfigProvider
import id.databisnis.android.bachot.libraries.mediaupload.test.FakeMediaPreProcessor
import id.databisnis.android.bachot.libraries.permissions.test.FakePermissionsPresenterFactory
import id.databisnis.android.bachot.libraries.voicerecorder.test.FakeVoiceRecorder
import id.databisnis.android.bachot.services.analytics.test.FakeAnalyticsService
import kotlinx.coroutines.CoroutineScope

class FakeDefaultVoiceMessageComposerPresenterFactory(
    private val sessionCoroutineScope: CoroutineScope,
    private val mediaSender: MediaSender = DefaultMediaSender(
        preProcessor = FakeMediaPreProcessor(),
        room = FakeJoinedRoom(),
        timelineMode = Timeline.Mode.Live,
        mediaOptimizationConfigProvider = FakeMediaOptimizationConfigProvider(),
    ),
) : DefaultVoiceMessageComposerPresenter.Factory {
    override fun create(timelineMode: Timeline.Mode): DefaultVoiceMessageComposerPresenter {
        return DefaultVoiceMessageComposerPresenter(
            sessionCoroutineScope = sessionCoroutineScope,
            timelineMode = timelineMode,
            voiceRecorder = FakeVoiceRecorder(),
            analyticsService = FakeAnalyticsService(),
            mediaSenderFactory = { mediaSender },
            player = VoiceMessageComposerPlayer(
                mediaPlayer = FakeMediaPlayer(),
                sessionCoroutineScope = sessionCoroutineScope,
            ),
            messageComposerContext = FakeMessageComposerContext(),
            permissionsPresenterFactory = FakePermissionsPresenterFactory(),
        )
    }
}
