package com.example.myapplication.api.item

import com.example.myapplication.database.entities.model.ItemFromBike
import kotlinx.serialization.Contextual
import kotlinx.serialization.Serializable
import org.threeten.bp.LocalDateTime

@Serializable
class ItemFromBikeRemote(
    val id: Int = 0,
    @Contextual
    val dateTime: LocalDateTime = LocalDateTime.MIN,
    val weight: Double = 0.0,
    val maxCount: Int = 0,
    val availableCount: Int = 0,
    val bikeId: Int = 0,
)

fun ItemFromBikeRemote.toItemFromBike(): ItemFromBike = ItemFromBike(
    id,
    dateTime,
    weight,
    availableCount,
    bikeId
)

fun ItemFromBike.toItemFromBikeRemote(): ItemFromBikeRemote = ItemFromBikeRemote(
    uid,
    dateTime,
    weight,
    availableCount,
    bikeId
)