package com.example.myapplication.api.item

import com.example.myapplication.api.bike.BikeRemote
import com.example.myapplication.api.bike.toBike
import com.example.myapplication.database.entities.model.ItemFromRent
import kotlinx.serialization.Contextual
import kotlinx.serialization.Serializable
import org.threeten.bp.LocalDateTime

@Serializable
class ItemFromRentRemote(
    val id: Int = 0,
    @Contextual val dateTime: LocalDateTime = LocalDateTime.MIN,
    val frozenWeight: Double = 0.0,
    val count: Int = 0,
    val bikeId: Int = 0,
)

fun ItemFromRentRemote.toItemFromRent(bike: BikeRemote): ItemFromRent =
    ItemFromRent(
        id, dateTime, frozenWeight, count, bikeId, bike.toBike()
    )