package com.example.shawarma.data.api.repos

import com.example.shawarma.data.api.MyServerService
import com.example.shawarma.data.api.models.TokenModelRemote
import com.example.shawarma.data.api.models.UserModelRemote
import com.example.shawarma.data.api.models.toUserModelRemote
import com.example.shawarma.data.models.UserModel
import javax.inject.Inject

class RestUserRepository @Inject constructor(
    private val service: MyServerService
) {
    suspend fun insert(user: UserModel) {
        service.createUser(user.toUserModelRemote())
    }

    suspend fun getToken(user: UserModel): TokenModelRemote {
        return service.getToken(user.toUserModelRemote())
    }

    suspend fun checkLogin(user: UserModel): UserModelRemote? {
        return service.checkLogin(user.toUserModelRemote())
    }
}