package com.example.projectbnspumkm

import android.app.Application
import com.example.projectbnspumkm.data.local.AppDatabase
import com.example.projectbnspumkm.data.remote.ApiService
import com.example.projectbnspumkm.data.repository.UmkmRepository
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class UmkmApplication : Application() {
    
    private val database by lazy { AppDatabase.getDatabase(this) }
    
    private val apiService by lazy {
        Retrofit.Builder()
            .baseUrl("https://api.example.com/") // Placeholder URL
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(ApiService::class.java)
    }

    val repository by lazy { 
        UmkmRepository(apiService, database.productDao(), database.customerDao(), database.cartDao()) 
    }
}
