package de.tsschulz.timeclock.data.api

import kotlinx.serialization.Serializable

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

@Serializable
data class ClockRequest(
    val action: String,
)

@Serializable
data class ClockResponse(
    val success: Boolean = false,
    val message: String? = null,
    val entry: RunningEntryDto? = null,
    val error: String? = null,
)

@Serializable
data class RunningEntryDto(
    val id: String? = null,
    val startTime: String? = null,
    val currentPauseStart: String? = null,
)

@Serializable
data class TimeStatsDto(
    val totalEntries: Int? = null,
    val completedEntries: Int? = null,
    val runningEntries: Int? = null,
    val totalHours: String? = null,
    val timestamp: String? = null,
    val currentlyWorked: String? = null,
    val open: String? = null,
    val requiredBreakMinutes: Int? = null,
    val alreadyTakenBreakMinutes: Int? = null,
    val missingBreakMinutes: Int? = null,
    val regularEnd: String? = null,
    val overtime: String? = null,
    val totalOvertime: String? = null,
    val weekWorktime: String? = null,
    val nonWorkingHours: String? = null,
    val openForWeek: String? = null,
    val adjustedEndToday: String? = null,
    val adjustedEndTodayGeneral: String? = null,
    val adjustedEndTodayWeek: String? = null,
)

@Serializable
data class TimeEntryDto(
    val id: String,
    val project: String? = null,
    val description: String? = null,
    val startTime: String? = null,
    val endTime: String? = null,
    val duration: Long? = null,
    val isRunning: Boolean = false,
    val userId: String? = null,
)

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

@Serializable
data class WeekOverviewDto(
    val weekStart: String? = null,
    val weekEnd: String? = null,
    val weekTotal: String? = null,
    val totalAll: String? = null,
    val nonWorkingTotal: String? = null,
    val nonWorkingDays: Int = 0,
    val nonWorkingDetails: List<NonWorkingDetailDto> = emptyList(),
    val days: List<WeekDayDto> = emptyList(),
)

@Serializable
data class WeekDayDto(
    val name: String? = null,
    val date: String? = null,
    val isToday: Boolean = false,
    val workTime: String? = null,
    val totalWorkTime: String? = null,
    val netWorkTime: String? = null,
    val holiday: WeekDayHolidayDto? = null,
    val vacation: WeekDayVacationDto? = null,
    val sick: WeekDaySickDto? = null,
    val status: String? = null,
    val statusText: String? = null,
    val workBlocks: List<WorkBlockDto> = emptyList(),
)

@Serializable
data class WorkBlockDto(
    val workTime: String? = null,
    val totalWorkTime: String? = null,
    val netWorkTime: String? = null,
)

@Serializable
data class WeekDayHolidayDto(
    val hours: Double = 0.0,
    val description: String? = null,
)

@Serializable
data class WeekDayVacationDto(
    val hours: Double = 0.0,
    val halfDay: Boolean = false,
)

@Serializable
data class WeekDaySickDto(
    val hours: Double = 0.0,
    val type: String? = null,
)

@Serializable
data class NonWorkingDetailDto(
    val date: String? = null,
    val type: String? = null,
    val hours: Double = 0.0,
)
