All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.api.bloxy.model.dto.token.HolderDetails.kt Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package io.api.bloxy.model.dto.token

import com.beust.klaxon.Json
import io.api.bloxy.model.IAddressModel
import io.api.bloxy.model.IModel
import io.api.bloxy.model.dto.AddressType
import io.api.bloxy.util.ParamConverter


/**
 * ! NO DESCRIPTION !
 *
 * @author GoodforGod
 * @since 16.11.2018
 */
data class HolderDetails(
    @Json(name = "address_type") val typeAsString: String = "",
    @Json(name = "uniq_senders") val uniqSenders: Long = 0,
    @Json(name = "to_count") val toCount: Long = 0,
    @Json(name = "to_amount") val toAmount: Double = .0,
    @Json(name = "from_count") val fromCount: Long = 0,
    @Json(name = "uniq_receivers") val uniqReceivers: Long = 0,
    @Json(name = "from_amount") val fromAmount: Double = .0,
    @Json(name = "first_tx_at") val firstTxAtAsString: String = "",
    @Json(name = "last_tx_at") val lastTxAtAsString: String = "",
    val address: String = "",
    val balance: Double = .0,
    val annotation: String = ""
) : IModel, IAddressModel {

    @Json(ignored = true) val firstTxAt = ParamConverter.parseDateTime(firstTxAtAsString)
    @Json(ignored = true) val lastTxAt = ParamConverter.parseDateTime(lastTxAtAsString)

    fun haveFirstTxTime() : Boolean = firstTxAt != null
    fun haveLastTxTime() : Boolean = lastTxAt != null

    override val addrType: AddressType = AddressType.parse(typeAsString)

    override fun isEmpty(): Boolean {
        return address.isEmpty() && typeAsString.isEmpty() && toCount == 0L && fromCount == 0L
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy