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.ItemFromCart
import kotlinx.serialization.Serializable
import org.threeten.bp.LocalDateTime

@Serializable
class ItemFromCartRemote(
    val id: Int = 0,
    var count: Int = 0,
    var bikeId: Int = 0,
)

fun ItemFromCartRemote.toItemFromCart(bike: BikeRemote, dateTime: LocalDateTime, weight: Double, availableCount: Int): ItemFromCart =
    ItemFromCart(
        id, dateTime, weight, availableCount, count, bike.id, bike.toBike()
    )