package com.kdanmobile.reader.koin

import android.content.Context
import android.content.Intent
import com.kdanmobile.reader.copyfile.CopyFileViewModel
import com.kdanmobile.reader.copyfile.CopyFileInfo
import android.net.Uri
import com.kdanmobile.reader.Config
import com.kdanmobile.reader.ReaderModel
import com.kdanmobile.reader.ReaderModelManager
import com.kdanmobile.reader.ReaderViewModel
import com.kdanmobile.reader.thumb.PdfThumbViewModel
import org.koin.android.viewmodel.dsl.viewModel
import org.koin.dsl.module
import java.io.File

object KoinModule {
    val m = module {
        single { ReaderModelManager() }
        viewModel { (applicationContext: Context, intent: Intent, copiedFileFolder: File) ->
            CopyFileViewModel(applicationContext, intent, copiedFileFolder)
        }
        viewModel { (uri: Uri) ->
            ReaderViewModel(
                    get(),
                    uri,
                    Config.PDF_SDK_LICENSE,
                    Config.PDF_SDK_RSA_MSG
            )
        }
        viewModel { (readerModel: ReaderModel) -> PdfThumbViewModel(readerModel) }
    }
}