package com.example.myapplication.api.item

/*
@Serializable
data class BikeWithItemsRemote(
    val id: Int = 0,
    val name: String = "",
    val description: String = "",
    val image: ByteArray? = null
    @SerialName("items")
    val items: List<ItemFromBikeRemote>,
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as BikeWithItemsRemote

        if (id != other.id) return false
        if (name != other.name) return false
        if (description != other.description) return false
        if (image != null) {
            if (other.image == null) return false
            if (!image.contentEquals(other.image)) return false
        } else if (other.image != null) return false
        if (items != other.items) return false

        return true
    }

    override fun hashCode(): Int {
        var result = id
        result = 31 * result + name.hashCode()
        result = 31 * result + description.hashCode()
        result = 31 * result + (image?.contentHashCode() ?: 0)
        result = 31 * result + items.hashCode()
        return result
    }
}

fun BikeWithItemsRemote.toBikeWithItems(): BikeWithItems = BikeWithItems(
    Bike(
        id,
        name,
        description,
        image
    ),
    items.map { x -> x.toItemFromBike() }
)

fun Bike.toBikeWithItemsRemote(): BikeWithItemsRemote = BikeWithItemsRemote(
    uid,
    name,
    description,
    image,
    items = emptyList()
)*/
