package com.isidroid.job_sender.domain.use_case

import com.isidroid.core.DiMock
import com.isidroid.job.constant.JobStatus
import com.isidroid.job.constant.SendJobStatus
import com.isidroid.job.repository.JobRepository
import com.isidroid.job_sender.SendJobEventCollectorFlow
import com.isidroid.job_sender.data.source.local.SendJobLocalSource
import com.isidroid.job_sender.ext.createRenderItems
import com.isidroid.job_sender.repository.JobSendRepository
import com.isidroid.rendering.repository.RenderRepository
import com.isidroid.spot.repository.SpotRepository
import kotlinx.coroutines.delay
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class SendPrintJobsUseCase @Inject constructor(
    private val repository: JobSendRepository,
    @DiMock private val debug: Boolean
) {
    suspend fun start() {
        repository.checkNotRenderedPrintJobs(repository.getJobList(JobStatus.IDLE))
        repository.readFilesAndSend(repository.getJobSenderList(SendJobStatus.RENDERED))
        repository.markJobUploaded(repository.getJobList(JobStatus.RENDER_UPLOAD))
    }
}