package com.adealink.weparty.share.poster.viewmodel

import com.adealink.frame.base.Rlt
import com.adealink.frame.mvvm.viewmodel.BaseViewModel
import com.adealink.weparty.App
import com.adealink.weparty.share.data.LastOrderData
import com.adealink.weparty.share.datasource.remote.ShareHttpService

class PosterViewModel : BaseViewModel() {

    private val shareHttpService by lazy {
        App.instance.networkService.getHttpService(ShareHttpService::class.java)
    }

    suspend fun getLastOrder(): LastOrderData? {
        val rlt = shareHttpService.lastOrder()
        return when (rlt) {
            is Rlt.Failed -> {
                null
            }

            is Rlt.Success -> {
                rlt.data.data
            }
        }
    }

}