package com.example.myapplication.api.item

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

@Serializable
data class ItemWithBikeRemote(
    val id: Int = 0,
    @Contextual
    val dateTime: LocalDateTime,
    val weight: Double,
    val maxCount: Int,
    val bikeId: Int = 0,
    val bike: BikeRemote,
)

fun ItemWithBikeRemote.toItem(): Item = Item(
    id,
    dateTime,
    weight,
    maxCount,
    bikeId
)