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

commonMain.aws.sdk.kotlin.services.iotsitewise.model.AggregatedValue.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.iotsitewise.model

import aws.smithy.kotlin.runtime.SdkDsl
import aws.smithy.kotlin.runtime.time.Instant

/**
 * Contains aggregated asset property values (for example, average, minimum, and maximum).
 */
public class AggregatedValue private constructor(builder: Builder) {
    /**
     * The quality of the aggregated data.
     */
    public val quality: aws.sdk.kotlin.services.iotsitewise.model.Quality? = builder.quality
    /**
     * The date the aggregating computations occurred, in Unix epoch time.
     */
    public val timestamp: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.timestamp) { "A non-null value must be provided for timestamp" }
    /**
     * The value of the aggregates.
     */
    public val value: aws.sdk.kotlin.services.iotsitewise.model.Aggregates? = builder.value

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.iotsitewise.model.AggregatedValue = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("AggregatedValue(")
        append("quality=$quality,")
        append("timestamp=$timestamp,")
        append("value=$value")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = quality?.hashCode() ?: 0
        result = 31 * result + (timestamp.hashCode())
        result = 31 * result + (value?.hashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as AggregatedValue

        if (quality != other.quality) return false
        if (timestamp != other.timestamp) return false
        if (value != other.value) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.iotsitewise.model.AggregatedValue = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The quality of the aggregated data.
         */
        public var quality: aws.sdk.kotlin.services.iotsitewise.model.Quality? = null
        /**
         * The date the aggregating computations occurred, in Unix epoch time.
         */
        public var timestamp: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * The value of the aggregates.
         */
        public var value: aws.sdk.kotlin.services.iotsitewise.model.Aggregates? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.iotsitewise.model.AggregatedValue) : this() {
            this.quality = x.quality
            this.timestamp = x.timestamp
            this.value = x.value
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.iotsitewise.model.AggregatedValue = AggregatedValue(this)

        /**
         * construct an [aws.sdk.kotlin.services.iotsitewise.model.Aggregates] inside the given [block]
         */
        public fun value(block: aws.sdk.kotlin.services.iotsitewise.model.Aggregates.Builder.() -> kotlin.Unit) {
            this.value = aws.sdk.kotlin.services.iotsitewise.model.Aggregates.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (timestamp == null) timestamp = Instant.fromEpochSeconds(0)
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy