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

com.lithic.api.models.AuthStreamEnrollment.kt Maven / Gradle / Ivy

// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import java.util.Objects

@JsonDeserialize(builder = AuthStreamEnrollment.Builder::class)
@NoAutoDetect
class AuthStreamEnrollment
private constructor(
    private val enrolled: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

    /** Whether ASA is enrolled. */
    fun enrolled(): Boolean? = enrolled.getNullable("enrolled")

    /** Whether ASA is enrolled. */
    @JsonProperty("enrolled") @ExcludeMissing fun _enrolled() = enrolled

    @JsonAnyGetter
    @ExcludeMissing
    fun _additionalProperties(): Map = additionalProperties

    fun validate(): AuthStreamEnrollment = apply {
        if (!validated) {
            enrolled()
            validated = true
        }
    }

    fun toBuilder() = Builder().from(this)

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }

        return other is AuthStreamEnrollment &&
            this.enrolled == other.enrolled &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode = Objects.hash(enrolled, additionalProperties)
        }
        return hashCode
    }

    override fun toString() =
        "AuthStreamEnrollment{enrolled=$enrolled, additionalProperties=$additionalProperties}"

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var enrolled: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(authStreamEnrollment: AuthStreamEnrollment) = apply {
            this.enrolled = authStreamEnrollment.enrolled
            additionalProperties(authStreamEnrollment.additionalProperties)
        }

        /** Whether ASA is enrolled. */
        fun enrolled(enrolled: Boolean) = enrolled(JsonField.of(enrolled))

        /** Whether ASA is enrolled. */
        @JsonProperty("enrolled")
        @ExcludeMissing
        fun enrolled(enrolled: JsonField) = apply { this.enrolled = enrolled }

        fun additionalProperties(additionalProperties: Map) = apply {
            this.additionalProperties.clear()
            this.additionalProperties.putAll(additionalProperties)
        }

        @JsonAnySetter
        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
            this.additionalProperties.put(key, value)
        }

        fun putAllAdditionalProperties(additionalProperties: Map) = apply {
            this.additionalProperties.putAll(additionalProperties)
        }

        fun build(): AuthStreamEnrollment =
            AuthStreamEnrollment(enrolled, additionalProperties.toUnmodifiable())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy