package de.tsschulz.timeclock.data.api

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class LoginRequest(
    val email: String,
    val password: String,
    /** Entspricht dem Web-Login: `0` = keine Stempelaktion. */
    val action: String = "0",
)

@Serializable
data class LoginResponse(
    val success: Boolean = false,
    val token: String? = null,
    val user: UserDto? = null,
    val message: String? = null,
    val error: String? = null,
    val actionWarning: String? = null,
)

@Serializable
data class MeResponse(
    val success: Boolean = false,
    val user: UserDto? = null,
    val error: String? = null,
)

@Serializable
data class UserDto(
    val id: Int,
    @SerialName("full_name") val fullName: String,
    val email: String? = null,
    val role: Int = 0,
    @SerialName("daily_hours") val dailyHours: Double? = null,
    @SerialName("week_hours") val weekHours: Double? = null,
    @SerialName("week_workdays") val weekWorkdays: Int? = null,
)

@Serializable
data class ErrorBody(
    val error: String? = null,
    val message: String? = null,
)

@Serializable
data class LogoutResponse(
    val success: Boolean = true,
    val message: String? = null,
)

@Serializable
data class OAuthLinkUrlRequest(
    val platform: String = "android",
)

@Serializable
data class OAuthLinkUrlResponse(
    val success: Boolean = false,
    val url: String? = null,
    val error: String? = null,
)

@Serializable
data class OAuthLinkExistingRequest(
    val pendingToken: String,
    val email: String,
    val password: String,
)
