package com.zaojiao.app.core.auth.data

import com.zaojiao.app.core.auth.http.AuthClient
import com.zaojiao.app.core.auth.model.TokenModel
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class RemoteAuthData @Inject constructor(
    private val authClient: AuthClient,
) {
    suspend fun loginBySms(phone: String, code: String) {
        authClient.loginBySms(phone, code)
    }

    suspend fun loginByWechat(code: String) {
        authClient.loginByWechat(code)
    }

    suspend fun loginByOneClick(code: String) {
        authClient.loginByOneClick(code)
    }

    suspend fun refreshToken(refreshToken: String): TokenModel? {
        val result = authClient.refreshToken(refreshToken)
        return result.data
    }
}