/**
 * qsfera Android client application
 *
 * @author David González Verdugo
 * @author Abel García de Prada
 * @author Juan Carlos Garrote Gascón
 * @author Aitor Ballesteros Pavón
 * @author Jorge Aguado Recio
 *
 * Copyright (C) 2024 ownCloud GmbH.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package eu.qsfera.android.dependecyinjection

import eu.qsfera.android.domain.appregistry.usecases.CreateFileWithAppProviderUseCase
import eu.qsfera.android.domain.appregistry.usecases.GetAppRegistryForMimeTypeAsStreamUseCase
import eu.qsfera.android.domain.appregistry.usecases.GetAppRegistryWhichAllowCreationAsStreamUseCase
import eu.qsfera.android.domain.appregistry.usecases.GetUrlToOpenInWebUseCase
import eu.qsfera.android.domain.authentication.oauth.OIDCDiscoveryUseCase
import eu.qsfera.android.domain.authentication.oauth.RegisterClientUseCase
import eu.qsfera.android.domain.authentication.oauth.RequestTokenUseCase
import eu.qsfera.android.domain.authentication.usecases.GetBaseUrlUseCase
import eu.qsfera.android.domain.authentication.usecases.LoginBasicAsyncUseCase
import eu.qsfera.android.domain.authentication.usecases.LoginOAuthAsyncUseCase
import eu.qsfera.android.domain.authentication.usecases.SupportsOAuth2UseCase
import eu.qsfera.android.domain.availableoffline.usecases.GetFilesAvailableOfflineFromAccountAsStreamUseCase
import eu.qsfera.android.domain.availableoffline.usecases.GetFilesAvailableOfflineFromAccountUseCase
import eu.qsfera.android.domain.availableoffline.usecases.GetFilesAvailableOfflineFromEveryAccountUseCase
import eu.qsfera.android.domain.availableoffline.usecases.SetFilesAsAvailableOfflineUseCase
import eu.qsfera.android.domain.availableoffline.usecases.UnsetFilesAsAvailableOfflineUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.GetAutomaticUploadsConfigurationUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.GetPictureUploadsConfigurationStreamUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.GetVideoUploadsConfigurationStreamUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.ResetPictureUploadsUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.ResetVideoUploadsUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.SavePictureUploadsConfigurationUseCase
import eu.qsfera.android.domain.automaticuploads.usecases.SaveVideoUploadsConfigurationUseCase
import eu.qsfera.android.domain.capabilities.usecases.GetCapabilitiesAsLiveDataUseCase
import eu.qsfera.android.domain.capabilities.usecases.GetStoredCapabilitiesUseCase
import eu.qsfera.android.domain.capabilities.usecases.RefreshCapabilitiesFromServerAsyncUseCase
import eu.qsfera.android.domain.files.usecases.IsAnyFileAvailableLocallyAndNotAvailableOfflineUseCase
import eu.qsfera.android.domain.files.usecases.CleanConflictUseCase
import eu.qsfera.android.domain.files.usecases.CleanWorkersUUIDUseCase
import eu.qsfera.android.domain.files.usecases.CopyFileUseCase
import eu.qsfera.android.domain.files.usecases.CreateFolderAsyncUseCase
import eu.qsfera.android.domain.files.usecases.DisableThumbnailsForFileUseCase
import eu.qsfera.android.domain.files.usecases.GetFileByIdAsStreamUseCase
import eu.qsfera.android.domain.files.usecases.GetFileByIdUseCase
import eu.qsfera.android.domain.files.usecases.GetFileByRemotePathUseCase
import eu.qsfera.android.domain.files.usecases.GetFileWithSyncInfoByIdUseCase
import eu.qsfera.android.domain.files.usecases.GetFolderContentAsStreamUseCase
import eu.qsfera.android.domain.files.usecases.GetFolderContentUseCase
import eu.qsfera.android.domain.files.usecases.GetFolderImagesUseCase
import eu.qsfera.android.domain.files.usecases.GetPersonalRootFolderForAccountUseCase
import eu.qsfera.android.domain.files.usecases.GetSearchFolderContentUseCase
import eu.qsfera.android.domain.files.usecases.GetSharedByLinkForAccountAsStreamUseCase
import eu.qsfera.android.domain.files.usecases.GetSharesRootFolderForAccount
import eu.qsfera.android.domain.files.usecases.GetWebDavUrlForSpaceUseCase
import eu.qsfera.android.domain.files.usecases.ManageDeepLinkUseCase
import eu.qsfera.android.domain.files.usecases.MoveFileUseCase
import eu.qsfera.android.domain.files.usecases.RemoveFileUseCase
import eu.qsfera.android.domain.files.usecases.RenameFileUseCase
import eu.qsfera.android.domain.files.usecases.SaveConflictUseCase
import eu.qsfera.android.domain.files.usecases.SaveDownloadWorkerUUIDUseCase
import eu.qsfera.android.domain.files.usecases.SaveFileOrFolderUseCase
import eu.qsfera.android.domain.files.usecases.SetLastUsageFileUseCase
import eu.qsfera.android.domain.files.usecases.SortFilesUseCase
import eu.qsfera.android.domain.files.usecases.SortFilesWithSyncInfoUseCase
import eu.qsfera.android.domain.files.usecases.UpdateAlreadyDownloadedFilesPathUseCase
import eu.qsfera.android.domain.server.usecases.GetServerInfoAsyncUseCase
import eu.qsfera.android.domain.sharing.sharees.GetShareesAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.CreatePrivateShareAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.CreatePublicShareAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.DeleteShareAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.EditPrivateShareAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.EditPublicShareAsyncUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.GetShareAsLiveDataUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.GetSharesAsLiveDataUseCase
import eu.qsfera.android.domain.sharing.shares.usecases.RefreshSharesFromServerAsyncUseCase
import eu.qsfera.android.domain.spaces.usecases.GetPersonalAndProjectSpacesForAccountUseCase
import eu.qsfera.android.domain.spaces.usecases.GetPersonalAndProjectSpacesWithSpecialsForAccountAsStreamUseCase
import eu.qsfera.android.domain.spaces.usecases.GetPersonalSpaceForAccountUseCase
import eu.qsfera.android.domain.spaces.usecases.GetPersonalSpacesWithSpecialsForAccountAsStreamUseCase
import eu.qsfera.android.domain.spaces.usecases.GetProjectSpacesWithSpecialsForAccountAsStreamUseCase
import eu.qsfera.android.domain.spaces.usecases.GetSpaceByIdForAccountUseCase
import eu.qsfera.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase
import eu.qsfera.android.domain.spaces.usecases.GetSpacesFromEveryAccountUseCaseAsStream
import eu.qsfera.android.domain.spaces.usecases.RefreshSpacesFromServerAsyncUseCase
import eu.qsfera.android.domain.transfers.usecases.ClearSuccessfulTransfersUseCase
import eu.qsfera.android.domain.transfers.usecases.GetAllTransfersAsStreamUseCase
import eu.qsfera.android.domain.transfers.usecases.GetAllTransfersUseCase
import eu.qsfera.android.domain.transfers.usecases.UpdatePendingUploadsPathUseCase
import eu.qsfera.android.domain.user.usecases.GetStoredQuotaUseCase
import eu.qsfera.android.domain.user.usecases.GetStoredQuotaAsStreamUseCase
import eu.qsfera.android.domain.user.usecases.GetUserAvatarAsyncUseCase
import eu.qsfera.android.domain.user.usecases.GetUserInfoAsyncUseCase
import eu.qsfera.android.domain.user.usecases.GetUserQuotasUseCase
import eu.qsfera.android.domain.user.usecases.GetUserQuotasAsStreamUseCase
import eu.qsfera.android.domain.user.usecases.RefreshUserQuotaFromServerAsyncUseCase
import eu.qsfera.android.domain.webfinger.usecases.GetQSferaInstanceFromWebFingerUseCase
import eu.qsfera.android.domain.webfinger.usecases.GetQSferaInstancesFromAuthenticatedWebFingerUseCase
import eu.qsfera.android.usecases.accounts.RemoveAccountUseCase
import eu.qsfera.android.usecases.files.FilterFileMenuOptionsUseCase
import eu.qsfera.android.usecases.files.RemoveLocalFilesForAccountUseCase
import eu.qsfera.android.usecases.files.RemoveLocallyFilesWithLastUsageOlderThanGivenTimeUseCase
import eu.qsfera.android.usecases.synchronization.SynchronizeFileUseCase
import eu.qsfera.android.usecases.synchronization.SynchronizeFolderUseCase
import eu.qsfera.android.usecases.transfers.downloads.CancelDownloadForFileUseCase
import eu.qsfera.android.usecases.transfers.downloads.CancelDownloadsRecursivelyUseCase
import eu.qsfera.android.usecases.transfers.downloads.DownloadFileUseCase
import eu.qsfera.android.usecases.transfers.downloads.GetLiveDataForDownloadingFileUseCase
import eu.qsfera.android.usecases.transfers.downloads.GetLiveDataForFinishedDownloadsFromAccountUseCase
import eu.qsfera.android.usecases.transfers.uploads.CancelTransfersFromAccountUseCase
import eu.qsfera.android.usecases.transfers.uploads.CancelUploadForFileUseCase
import eu.qsfera.android.usecases.transfers.uploads.CancelUploadUseCase
import eu.qsfera.android.usecases.transfers.uploads.CancelUploadsRecursivelyUseCase
import eu.qsfera.android.usecases.transfers.uploads.ClearFailedTransfersUseCase
import eu.qsfera.android.usecases.transfers.uploads.RetryFailedUploadsForAccountUseCase
import eu.qsfera.android.usecases.transfers.uploads.RetryFailedUploadsUseCase
import eu.qsfera.android.usecases.transfers.uploads.RetryUploadFromContentUriUseCase
import eu.qsfera.android.usecases.transfers.uploads.RetryUploadFromSystemUseCase
import eu.qsfera.android.usecases.transfers.uploads.UploadFileFromContentUriUseCase
import eu.qsfera.android.usecases.transfers.uploads.UploadFileFromSystemUseCase
import eu.qsfera.android.usecases.transfers.uploads.UploadFileInConflictUseCase
import eu.qsfera.android.usecases.transfers.uploads.UploadFilesFromContentUriUseCase
import eu.qsfera.android.usecases.transfers.uploads.UploadFilesFromSystemUseCase
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.module

val useCaseModule = module {
    // Authentication
    factoryOf(::GetBaseUrlUseCase)
    factoryOf(::GetQSferaInstanceFromWebFingerUseCase)
    factoryOf(::GetQSferaInstancesFromAuthenticatedWebFingerUseCase)
    factoryOf(::LoginBasicAsyncUseCase)
    factoryOf(::LoginOAuthAsyncUseCase)
    factoryOf(::SupportsOAuth2UseCase)

    // OAuth
    factoryOf(::OIDCDiscoveryUseCase)
    factoryOf(::RegisterClientUseCase)
    factoryOf(::RequestTokenUseCase)

    // Capabilities
    factoryOf(::GetCapabilitiesAsLiveDataUseCase)
    factoryOf(::GetStoredCapabilitiesUseCase)
    factoryOf(::RefreshCapabilitiesFromServerAsyncUseCase)

    // Files
    factoryOf(::CleanConflictUseCase)
    factoryOf(::CleanWorkersUUIDUseCase)
    factoryOf(::CopyFileUseCase)
    factoryOf(::CreateFolderAsyncUseCase)
    factoryOf(::DisableThumbnailsForFileUseCase)
    factoryOf(::FilterFileMenuOptionsUseCase)
    factoryOf(::GetFileByIdAsStreamUseCase)
    factoryOf(::GetFileByIdUseCase)
    factoryOf(::GetFileByRemotePathUseCase)
    factoryOf(::GetFileWithSyncInfoByIdUseCase)
    factoryOf(::GetFolderContentAsStreamUseCase)
    factoryOf(::GetFolderContentUseCase)
    factoryOf(::GetFolderImagesUseCase)
    factoryOf(::IsAnyFileAvailableLocallyAndNotAvailableOfflineUseCase)
    factoryOf(::GetPersonalRootFolderForAccountUseCase)
    factoryOf(::GetSearchFolderContentUseCase)
    factoryOf(::GetSharedByLinkForAccountAsStreamUseCase)
    factoryOf(::GetSharesRootFolderForAccount)
    factoryOf(::GetUrlToOpenInWebUseCase)
    factoryOf(::ManageDeepLinkUseCase)
    factoryOf(::MoveFileUseCase)
    factoryOf(::RemoveFileUseCase)
    factoryOf(::RemoveLocalFilesForAccountUseCase)
    factoryOf(::RemoveLocallyFilesWithLastUsageOlderThanGivenTimeUseCase)
    factoryOf(::RenameFileUseCase)
    factoryOf(::SaveConflictUseCase)
    factoryOf(::SaveDownloadWorkerUUIDUseCase)
    factoryOf(::SaveFileOrFolderUseCase)
    factoryOf(::SetLastUsageFileUseCase)
    factoryOf(::SortFilesUseCase)
    factoryOf(::SortFilesWithSyncInfoUseCase)
    factoryOf(::SynchronizeFileUseCase)
    factoryOf(::SynchronizeFolderUseCase)

    // Open in web
    factoryOf(::CreateFileWithAppProviderUseCase)
    factoryOf(::GetAppRegistryForMimeTypeAsStreamUseCase)
    factoryOf(::GetAppRegistryWhichAllowCreationAsStreamUseCase)
    factoryOf(::GetUrlToOpenInWebUseCase)

    // Av Offline
    factoryOf(::GetFilesAvailableOfflineFromAccountAsStreamUseCase)
    factoryOf(::GetFilesAvailableOfflineFromAccountUseCase)
    factoryOf(::GetFilesAvailableOfflineFromEveryAccountUseCase)
    factoryOf(::SetFilesAsAvailableOfflineUseCase)
    factoryOf(::UnsetFilesAsAvailableOfflineUseCase)

    // Sharing
    factoryOf(::CreatePrivateShareAsyncUseCase)
    factoryOf(::CreatePublicShareAsyncUseCase)
    factoryOf(::DeleteShareAsyncUseCase)
    factoryOf(::EditPrivateShareAsyncUseCase)
    factoryOf(::EditPublicShareAsyncUseCase)
    factoryOf(::GetShareAsLiveDataUseCase)
    factoryOf(::GetShareesAsyncUseCase)
    factoryOf(::GetSharesAsLiveDataUseCase)
    factoryOf(::RefreshSharesFromServerAsyncUseCase)

    // Spaces
    factoryOf(::GetPersonalAndProjectSpacesForAccountUseCase)
    factoryOf(::GetPersonalAndProjectSpacesWithSpecialsForAccountAsStreamUseCase)
    factoryOf(::GetPersonalSpaceForAccountUseCase)
    factoryOf(::GetPersonalSpacesWithSpecialsForAccountAsStreamUseCase)
    factoryOf(::GetProjectSpacesWithSpecialsForAccountAsStreamUseCase)
    factoryOf(::GetSpaceWithSpecialsByIdForAccountUseCase)
    factoryOf(::GetSpacesFromEveryAccountUseCaseAsStream)
    factoryOf(::GetWebDavUrlForSpaceUseCase)
    factoryOf(::RefreshSpacesFromServerAsyncUseCase)
    factoryOf(::GetSpaceByIdForAccountUseCase)

    // Transfers
    factoryOf(::CancelDownloadForFileUseCase)
    factoryOf(::CancelDownloadsRecursivelyUseCase)
    factoryOf(::CancelTransfersFromAccountUseCase)
    factoryOf(::CancelUploadForFileUseCase)
    factoryOf(::CancelUploadUseCase)
    factoryOf(::CancelUploadsRecursivelyUseCase)
    factoryOf(::ClearFailedTransfersUseCase)
    factoryOf(::ClearSuccessfulTransfersUseCase)
    factoryOf(::DownloadFileUseCase)
    factoryOf(::GetAllTransfersAsStreamUseCase)
    factoryOf(::GetAllTransfersUseCase)
    factoryOf(::GetLiveDataForDownloadingFileUseCase)
    factoryOf(::GetLiveDataForFinishedDownloadsFromAccountUseCase)
    factoryOf(::RetryFailedUploadsForAccountUseCase)
    factoryOf(::RetryFailedUploadsUseCase)
    factoryOf(::RetryUploadFromContentUriUseCase)
    factoryOf(::RetryUploadFromSystemUseCase)
    factoryOf(::UpdateAlreadyDownloadedFilesPathUseCase)
    factoryOf(::UpdatePendingUploadsPathUseCase)
    factoryOf(::UploadFileFromContentUriUseCase)
    factoryOf(::UploadFileFromSystemUseCase)
    factoryOf(::UploadFileInConflictUseCase)
    factoryOf(::UploadFilesFromContentUriUseCase)
    factoryOf(::UploadFilesFromSystemUseCase)

    // User
    factoryOf(::GetStoredQuotaAsStreamUseCase)
    factoryOf(::GetStoredQuotaUseCase)
    factoryOf(::GetUserAvatarAsyncUseCase)
    factoryOf(::GetUserInfoAsyncUseCase)
    factoryOf(::GetUserQuotasAsStreamUseCase)
    factoryOf(::GetUserQuotasUseCase)
    factoryOf(::RefreshUserQuotaFromServerAsyncUseCase)

    // Server
    factoryOf(::GetServerInfoAsyncUseCase)

    // Camera Uploads
    factoryOf(::GetAutomaticUploadsConfigurationUseCase)
    factoryOf(::GetPictureUploadsConfigurationStreamUseCase)
    factoryOf(::GetVideoUploadsConfigurationStreamUseCase)
    factoryOf(::ResetPictureUploadsUseCase)
    factoryOf(::ResetVideoUploadsUseCase)
    factoryOf(::SavePictureUploadsConfigurationUseCase)
    factoryOf(::SaveVideoUploadsConfigurationUseCase)

    // Accounts
    factoryOf(::RemoveAccountUseCase)
}
