package de.tsschulz.tt_tagebuch.shared.api.models

import kotlinx.serialization.Serializable

@Serializable
data class OrderMemberSnippetDto(
    val id: Int? = null,
    val firstName: String? = null,
    val lastName: String? = null,
)

@Serializable
data class OrderClubSnippetDto(
    val id: Int? = null,
    val name: String? = null,
)

@Serializable
data class MemberOrderHistoryEntryDto(
    val id: Int? = null,
    val status: String? = null,
    val changedAt: String? = null,
    val cost: Double? = null,
    val paidAmount: Double? = null,
    val budget: Double? = null,
    val paidConfirmed: Boolean? = null,
)

@Serializable
data class MemberOrderDto(
    val id: Int,
    val memberId: Int? = null,
    val clubId: Int? = null,
    val item: String = "",
    val status: String = "requested",
    val orderDate: String? = null,
    val statusDate: String? = null,
    val createdAt: String? = null,
    val updatedAt: String? = null,
    val cost: Double = 0.0,
    val paidAmount: Double = 0.0,
    val budget: Double = 0.0,
    val paidConfirmed: Boolean = false,
    val openAmount: Double = 0.0,
    val member: OrderMemberSnippetDto? = null,
    val club: OrderClubSnippetDto? = null,
    val historyEntries: List<MemberOrderHistoryEntryDto> = emptyList(),
)

@Serializable
data class MemberOrdersListEnvelope(
    val success: Boolean = false,
    val orders: List<MemberOrderDto> = emptyList(),
)

@Serializable
data class MemberOrderEnvelope(
    val success: Boolean = false,
    val order: MemberOrderDto? = null,
)

@Serializable
data class MemberOrderCreateBody(
    val item: String,
    val status: String = "requested",
    val cost: Double = 0.0,
    val paidAmount: Double = 0.0,
    val budget: Double = 0.0,
    val paidConfirmed: Boolean = false,
)

@Serializable
data class MemberOrderPatchBody(
    val item: String,
    val status: String,
    val cost: Double,
    val paidAmount: Double,
    val budget: Double,
    val paidConfirmed: Boolean,
)
