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

commonMain.aws.sdk.kotlin.services.pinpointsmsvoicev2.model.RegistrationFieldDefinition.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.pinpointsmsvoicev2.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Provides a description of the specified field.
 */
public class RegistrationFieldDefinition private constructor(builder: Builder) {
    /**
     * An array of RegistrationFieldDisplayHints objects for the field.
     */
    public val displayHints: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.RegistrationFieldDisplayHints? = builder.displayHints
    /**
     * The path to the registration form field. You can use DescribeRegistrationFieldDefinitions for a list of **FieldPaths**.
     */
    public val fieldPath: kotlin.String = requireNotNull(builder.fieldPath) { "A non-null value must be provided for fieldPath" }
    /**
     * Specifies if the field for the registration form is required, conditional or optional.
     */
    public val fieldRequirement: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.FieldRequirement = requireNotNull(builder.fieldRequirement) { "A non-null value must be provided for fieldRequirement" }
    /**
     * The type of field.
     */
    public val fieldType: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.FieldType = requireNotNull(builder.fieldType) { "A non-null value must be provided for fieldType" }
    /**
     * The section path of the field.
     */
    public val sectionPath: kotlin.String = requireNotNull(builder.sectionPath) { "A non-null value must be provided for sectionPath" }
    /**
     * The validation rules for a select field.
     */
    public val selectValidation: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.SelectValidation? = builder.selectValidation
    /**
     * The validation rules for a text field.
     */
    public val textValidation: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation? = builder.textValidation

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

    override fun toString(): kotlin.String = buildString {
        append("RegistrationFieldDefinition(")
        append("displayHints=$displayHints,")
        append("fieldPath=$fieldPath,")
        append("fieldRequirement=$fieldRequirement,")
        append("fieldType=$fieldType,")
        append("sectionPath=$sectionPath,")
        append("selectValidation=$selectValidation,")
        append("textValidation=$textValidation")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = displayHints?.hashCode() ?: 0
        result = 31 * result + (fieldPath.hashCode())
        result = 31 * result + (fieldRequirement.hashCode())
        result = 31 * result + (fieldType.hashCode())
        result = 31 * result + (sectionPath.hashCode())
        result = 31 * result + (selectValidation?.hashCode() ?: 0)
        result = 31 * result + (textValidation?.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 RegistrationFieldDefinition

        if (displayHints != other.displayHints) return false
        if (fieldPath != other.fieldPath) return false
        if (fieldRequirement != other.fieldRequirement) return false
        if (fieldType != other.fieldType) return false
        if (sectionPath != other.sectionPath) return false
        if (selectValidation != other.selectValidation) return false
        if (textValidation != other.textValidation) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * An array of RegistrationFieldDisplayHints objects for the field.
         */
        public var displayHints: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.RegistrationFieldDisplayHints? = null
        /**
         * The path to the registration form field. You can use DescribeRegistrationFieldDefinitions for a list of **FieldPaths**.
         */
        public var fieldPath: kotlin.String? = null
        /**
         * Specifies if the field for the registration form is required, conditional or optional.
         */
        public var fieldRequirement: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.FieldRequirement? = null
        /**
         * The type of field.
         */
        public var fieldType: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.FieldType? = null
        /**
         * The section path of the field.
         */
        public var sectionPath: kotlin.String? = null
        /**
         * The validation rules for a select field.
         */
        public var selectValidation: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.SelectValidation? = null
        /**
         * The validation rules for a text field.
         */
        public var textValidation: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.RegistrationFieldDefinition) : this() {
            this.displayHints = x.displayHints
            this.fieldPath = x.fieldPath
            this.fieldRequirement = x.fieldRequirement
            this.fieldType = x.fieldType
            this.sectionPath = x.sectionPath
            this.selectValidation = x.selectValidation
            this.textValidation = x.textValidation
        }

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

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

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

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

        internal fun correctErrors(): Builder {
            if (fieldPath == null) fieldPath = ""
            if (fieldRequirement == null) fieldRequirement = FieldRequirement.SdkUnknown("no value provided")
            if (fieldType == null) fieldType = FieldType.SdkUnknown("no value provided")
            if (sectionPath == null) sectionPath = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy