package de.tsschulz.tt_tagebuch.shared.repository

import de.tsschulz.tt_tagebuch.shared.api.ApiClient
import de.tsschulz.tt_tagebuch.shared.models.LoginResponse

class AuthRepository(private val apiClient: ApiClient) {
    suspend fun login(email: String, password: String): LoginResponse {
        val response = apiClient.login(email, password)
        if (response.success && response.token != null) {
            apiClient.setToken(response.token)
        }
        return response
    }
    
    fun logout() {
        apiClient.setToken(null)
    }
}
