package cz.muni.sutralog.repository

import cz.muni.sutralog.data.CategoryPresentableListItem
import cz.muni.sutralog.data.RockPresentableListItem
import cz.muni.sutralog.database.CategoryEntity
import cz.muni.sutralog.database.RockEntity

fun RockPresentableListItem.toRockEntity(): RockEntity =
    RockEntity(
        categoryId = this.categoryId,
        where = this.where,
        locality = this.locality,
        longitude = this.longitude,
        latitude = this.latitude,
        from = this.from,
        folderPath = this.folderPath,
        description = this.description,
        date = date,
        count = this.count,
        comment = this.comment,
        id = this.id,
        color = this.color,
        name = this.name,
        pictureName = this.pictureName
    )

fun RockEntity.toPresentableRockItem(): RockPresentableListItem =
    RockPresentableListItem(
        categoryId = this.categoryId,
        where = this.where,
        locality = this.locality,
        longitude = this.longitude,
        latitude = this.latitude,
        from = this.from,
        folderPath = this.folderPath,
        description = this.description,
        date = date,
        count = this.count,
        comment = this.comment,
        id = this.id,
        color = this.color,
        name = this.name,
        pictureName = this.pictureName
    )

fun CategoryPresentableListItem.toCategoryEntity(): CategoryEntity =
    CategoryEntity(
        id = this.id,
        name = this.name,
        color = this.color,
    )

fun CategoryEntity.toPresentableCategoryItem(): CategoryPresentableListItem =
    CategoryPresentableListItem(
        id = this.id,
        name = this.name,
        color = this.color,
    )