package lu.rewardflow.terminal

import android.app.Application
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

/**
 * Application entry point. Wires Hilt's [HiltWorkerFactory] into
 * WorkManager so [@HiltWorker] classes get constructor injection.
 *
 * The default WorkManager auto-initializer is disabled in the manifest
 * (see ``<provider>`` removal under ``androidx.startup``); WorkManager
 * picks up our [Configuration] via this provider on first access.
 */
@HiltAndroidApp
class RewardFlowApp : Application(), Configuration.Provider {

    @Inject
    lateinit var workerFactory: HiltWorkerFactory

    override val workManagerConfiguration: Configuration
        get() = Configuration.Builder()
            .setWorkerFactory(workerFactory)
            .build()
}
