package es.verdnatura.presentation.view.feature.packaging.model

import es.verdnatura.domain.isoToString
import es.verdnatura.presentation.common.convertToDateString

data class EntrySalix(
    var id: Number? = null,
    var dated: String? = null,
    var created: String? = null,
    var supplierFk: Number? = null,
    var travelFk: Number? = null,
    var companyFk: Number? = null,
    var observation: String? = null,
    var travel: TravelSalix? = null,
    var isError: Boolean = false,
    var errorMessage: String = ""
)

class TravelSalix {
    var landed: String = ""
        get() {
            return field.isoToString(returnOnlyDate = true)
        }
}

fun List<EntrySalix>.toDateFormat(): ArrayList<EntrySalix> {
    val entries: ArrayList<EntrySalix> = ArrayList()
    this.forEach {
        entries.add(
            EntrySalix(
                dated = convertToDateString(it.dated),
                created = convertToDateString(it.created)
            )
        )

    }
    return entries.sortedBy { it.dated } as ArrayList
}

data class ObervationEntry(
    val observation: String
)

data class NotificationQueue(
    val notificationFk: String,
    val authorFk: Int,
    val params: String
)
