package com.orange.net.net

import com.orange.myapplication.data.work.data.WeatherData

class NetHelper : Api {

    private val netWorkEngine: NetWorkEngine = NetWorkEngine()

    //java中的双重判断
    companion object{
        val netHelper: NetHelper by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
            NetHelper()
        }
    }

    fun init(reqUrl:String){
        netWorkEngine.init(reqUrl)
    }

    override suspend fun getWeatherInfo(id:String): WeatherData {
        return netWorkEngine.getWeatherInfo(id)
    }

}