package it.danieleverducci.openweddingapp.networking

import android.content.Context
import it.danieleverducci.openweddingapp.Config
import it.danieleverducci.openweddingapp.entities.RemoteSettings
import org.json.JSONObject

/**
 * Obtains the app settings from online static endpoint.
 * This is used to enable/disable photo sharing remotely and config notifications.
 */

class RemoteSettingsNet(context: Context): StaticItemNet<RemoteSettings>(context) {
    companion object {
        val TAG = "RemoteSettingsNet"
        val url = "${Config.API_BASE_URL}${Config.STATIC_ENDPOINT_SETTINGS}"
    }

    fun getItem(listener: OnItemObtainedListener<RemoteSettings>) {
        super.getItem(url, listener)
    }

    override fun newItem(jo: JSONObject): RemoteSettings {
        return RemoteSettings(jo)
    }

}