// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Kubernetes properties. */
@Fluent
public final class KubernetesProperties {
    /*
     * Relay connection string.
     */
    @JsonProperty(value = "relayConnectionString")
    private String relayConnectionString;

    /*
     * ServiceBus connection string.
     */
    @JsonProperty(value = "serviceBusConnectionString")
    private String serviceBusConnectionString;

    /*
     * Extension principal-id.
     */
    @JsonProperty(value = "extensionPrincipalId")
    private String extensionPrincipalId;

    /*
     * Extension instance release train.
     */
    @JsonProperty(value = "extensionInstanceReleaseTrain")
    private String extensionInstanceReleaseTrain;

    /*
     * VC name.
     */
    @JsonProperty(value = "vcName")
    private String vcName;

    /*
     * Compute namespace
     */
    @JsonProperty(value = "namespace")
    private String namespace;

    /*
     * Default instance type
     */
    @JsonProperty(value = "defaultInstanceType")
    private String defaultInstanceType;

    /*
     * Instance Type Schema
     */
    @JsonProperty(value = "instanceTypes")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, InstanceTypeSchema> instanceTypes;

    /** Creates an instance of KubernetesProperties class. */
    public KubernetesProperties() {
    }

    /**
     * Get the relayConnectionString property: Relay connection string.
     *
     * @return the relayConnectionString value.
     */
    public String relayConnectionString() {
        return this.relayConnectionString;
    }

    /**
     * Set the relayConnectionString property: Relay connection string.
     *
     * @param relayConnectionString the relayConnectionString value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withRelayConnectionString(String relayConnectionString) {
        this.relayConnectionString = relayConnectionString;
        return this;
    }

    /**
     * Get the serviceBusConnectionString property: ServiceBus connection string.
     *
     * @return the serviceBusConnectionString value.
     */
    public String serviceBusConnectionString() {
        return this.serviceBusConnectionString;
    }

    /**
     * Set the serviceBusConnectionString property: ServiceBus connection string.
     *
     * @param serviceBusConnectionString the serviceBusConnectionString value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withServiceBusConnectionString(String serviceBusConnectionString) {
        this.serviceBusConnectionString = serviceBusConnectionString;
        return this;
    }

    /**
     * Get the extensionPrincipalId property: Extension principal-id.
     *
     * @return the extensionPrincipalId value.
     */
    public String extensionPrincipalId() {
        return this.extensionPrincipalId;
    }

    /**
     * Set the extensionPrincipalId property: Extension principal-id.
     *
     * @param extensionPrincipalId the extensionPrincipalId value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withExtensionPrincipalId(String extensionPrincipalId) {
        this.extensionPrincipalId = extensionPrincipalId;
        return this;
    }

    /**
     * Get the extensionInstanceReleaseTrain property: Extension instance release train.
     *
     * @return the extensionInstanceReleaseTrain value.
     */
    public String extensionInstanceReleaseTrain() {
        return this.extensionInstanceReleaseTrain;
    }

    /**
     * Set the extensionInstanceReleaseTrain property: Extension instance release train.
     *
     * @param extensionInstanceReleaseTrain the extensionInstanceReleaseTrain value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withExtensionInstanceReleaseTrain(String extensionInstanceReleaseTrain) {
        this.extensionInstanceReleaseTrain = extensionInstanceReleaseTrain;
        return this;
    }

    /**
     * Get the vcName property: VC name.
     *
     * @return the vcName value.
     */
    public String vcName() {
        return this.vcName;
    }

    /**
     * Set the vcName property: VC name.
     *
     * @param vcName the vcName value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withVcName(String vcName) {
        this.vcName = vcName;
        return this;
    }

    /**
     * Get the namespace property: Compute namespace.
     *
     * @return the namespace value.
     */
    public String namespace() {
        return this.namespace;
    }

    /**
     * Set the namespace property: Compute namespace.
     *
     * @param namespace the namespace value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withNamespace(String namespace) {
        this.namespace = namespace;
        return this;
    }

    /**
     * Get the defaultInstanceType property: Default instance type.
     *
     * @return the defaultInstanceType value.
     */
    public String defaultInstanceType() {
        return this.defaultInstanceType;
    }

    /**
     * Set the defaultInstanceType property: Default instance type.
     *
     * @param defaultInstanceType the defaultInstanceType value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withDefaultInstanceType(String defaultInstanceType) {
        this.defaultInstanceType = defaultInstanceType;
        return this;
    }

    /**
     * Get the instanceTypes property: Instance Type Schema.
     *
     * @return the instanceTypes value.
     */
    public Map<String, InstanceTypeSchema> instanceTypes() {
        return this.instanceTypes;
    }

    /**
     * Set the instanceTypes property: Instance Type Schema.
     *
     * @param instanceTypes the instanceTypes value to set.
     * @return the KubernetesProperties object itself.
     */
    public KubernetesProperties withInstanceTypes(Map<String, InstanceTypeSchema> instanceTypes) {
        this.instanceTypes = instanceTypes;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (instanceTypes() != null) {
            instanceTypes()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
    }
}
