package com.sybotan.android.demo.viewmodel

import com.sybotan.android.demo.activities.BaseActivity
import com.sybotan.android.demo.entitiies.Build
import com.sybotan.android.demo.retrofit.BaseObserver
import com.sybotan.android.demo.retrofit.BaseViewModelInterface
import com.sybotan.android.demo.retrofit.RetrofitFactory

class BuildVM(b: BaseViewModelInterface, a: BaseActivity) : BaseViewModel(b, a) {
    companion object {
        const val BUILD_TYPE = "BUILD_TYPE"
    }

    fun getBuilds() {
        val observable = RetrofitFactory.getInstance().requestBuildJob()
        this.sendRequest(observable, object : BaseObserver<List<Build>>(mActivity, this) {
            override fun onSuccess(t: List<Build>?) {
                mEmitter.SendDircetive(BUILD_TYPE, t)
            }

        }, true)
    }
}