package com.zaojiao.app.data.remote

import com.zaojiao.app.core.common.state.DataState
import com.zaojiao.app.core.http.common.isSuccess
import com.zaojiao.app.core.http.common.toDataState
import com.zaojiao.app.core.http.common.tryRequest
import com.zaojiao.app.data.model.BabyModel
import com.zaojiao.app.data.model.BabyRelationModel
import com.zaojiao.app.data.remote.api.BabyApi
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class RemoteBabyData @Inject constructor(
    private val babyApi: BabyApi,
) {
    suspend fun getBabyList(): DataState<List<BabyModel>> {
        return tryRequest { babyApi.getBabyList().toDataState() }
    }

    suspend fun getBabyRelation(): DataState<List<BabyRelationModel>> {
        return tryRequest { babyApi.getBabyRelation().toDataState() }
    }
}