package com.ys.bdtp.adm.mvvm.vm.login

import com.ys.bdtp.adm.mvvm.model.Response
import com.ys.bdtp.adm.mvvm.model.db.AdmDatabase
import com.ys.bdtp.adm.mvvm.model.nt.Api
import com.ys.bdtp.adm.mvvm.model.request
import com.ys.bdtp.adm.mvvm.model.vo.request.Login
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * Login 存储仓库
 *
 * @author bai
 *
 * @param api
 */
class LoginRepository(private val api: Api, private val db: AdmDatabase) {

    /**
     * 登录
     */
    suspend fun login(login: Login): Response<String> {
        return withContext(Dispatchers.IO) {
            request {
                api.login(login)
            }
        }
    }
}