package de.tsschulz.timeclock.data.api

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

@Serializable
data class VacationDto(
    val id: String,
    val type: String? = null,
    val typeValue: Int = 0,
    val startDate: String? = null,
    val endDate: String? = null,
)

@Serializable
data class VacationCreateRequest(
    val vacationType: Int,
    val startDate: String,
    val endDate: String? = null,
)

@Serializable
data class SickEntryDto(
    val id: String,
    val startDate: String? = null,
    val endDate: String? = null,
    val sickTypeId: String? = null,
    val sickTypeName: String? = null,
)

@Serializable
data class SickTypeDto(
    val id: String,
    val name: String,
)

@Serializable
data class SickCreateRequest(
    val sickTypeId: String,
    val startDate: String,
    val endDate: String? = null,
)

@Serializable
data class TimefixDto(
    val id: String,
    val worklogId: String? = null,
    val newDate: String? = null,
    val newTime: String? = null,
    val newAction: String? = null,
    val originalDate: String? = null,
    val originalTime: String? = null,
    val originalAction: String? = null,
)

@Serializable
data class WorklogEntryDto(
    val id: String,
    @Serializable(with = FlexibleStringSerializer::class)
    val time: String? = null,
    @Serializable(with = FlexibleStringSerializer::class)
    val action: String? = null,
    @Serializable(with = FlexibleStringSerializer::class)
    val tstamp: String? = null,
)

@Serializable
data class TimefixCreateRequest(
    val worklogId: String,
    val newDate: String,
    val newTime: String,
    val newAction: String,
)

@Serializable
data class WorkdaysDto(
    val year: Int,
    val workdays: Int = 0,
    val holidays: Int = 0,
    val sickDays: Double = 0.0,
    val sickPercentage: Int = 0,
    val vacationDays: Double = 0.0,
    val workedDays: Int = 0,
)

@Serializable
data class CalendarDto(
    val year: Int,
    val month: Int,
    val weeks: List<List<CalendarDayDto>> = emptyList(),
)

@Serializable
data class CalendarDayDto(
    val date: String,
    val day: Int,
    val isCurrentMonth: Boolean = false,
    val isToday: Boolean = false,
    val holiday: String? = null,
    val sick: Boolean = false,
    val vacation: String? = null,
    val workedHours: Double? = null,
)

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