package com.prodhack.moscow2025.data.repImplementations

import android.app.Application
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.prodhack.moscow2025.data.data_providers.GalleryPagingSource
import com.prodhack.moscow2025.domain.interfaces.GalleryRepository
import kotlinx.coroutines.flow.Flow
import org.koin.core.annotation.Single

@Single
class GalleryRepositoryImpl(private val application: Application) : GalleryRepository {
	override fun getImagesIds(): Flow<PagingData<Long>> = Pager(
		config = PagingConfig(
			pageSize = 50,
			enablePlaceholders = false
		),
		pagingSourceFactory = {
			GalleryPagingSource(application.contentResolver)
		}
	).flow
}