// 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.azure.core.management.exception.ManagementError;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Compute Instance properties. */
@Fluent
public final class ComputeInstanceProperties {
    /*
     * Virtual Machine Size
     */
    @JsonProperty(value = "vmSize")
    private String vmSize;

    /*
     * Virtual network subnet resource ID the compute nodes belong to.
     */
    @JsonProperty(value = "subnet")
    private ResourceId subnet;

    /*
     * Sharing policy for applications on this compute instance
     *
     * Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the
     * creator can access applications on this compute instance. When Shared, any workspace user can access
     * applications on this instance depending on his/her assigned role.
     */
    @JsonProperty(value = "applicationSharingPolicy")
    private ApplicationSharingPolicy applicationSharingPolicy;

    /*
     * Specifies policy and settings for SSH access.
     */
    @JsonProperty(value = "sshSettings")
    private ComputeInstanceSshSettings sshSettings;

    /*
     * Describes all connectivity endpoints available for this ComputeInstance.
     */
    @JsonProperty(value = "connectivityEndpoints", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeInstanceConnectivityEndpoints connectivityEndpoints;

    /*
     * Describes available applications and their endpoints on this ComputeInstance.
     */
    @JsonProperty(value = "applications", access = JsonProperty.Access.WRITE_ONLY)
    private List<ComputeInstanceApplication> applications;

    /*
     * Describes information on user who created this ComputeInstance.
     */
    @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeInstanceCreatedBy createdBy;

    /*
     * Errors.
     *
     * Collection of errors encountered on this ComputeInstance.
     */
    @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ManagementError> errors;

    /*
     * The current state of this ComputeInstance.
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeInstanceState state;

    /*
     * Compute Instance Authorization type.
     *
     * The Compute Instance Authorization type. Available values are personal (default).
     */
    @JsonProperty(value = "computeInstanceAuthorizationType")
    private ComputeInstanceAuthorizationType computeInstanceAuthorizationType;

    /*
     * Settings for a personal compute instance.
     */
    @JsonProperty(value = "personalComputeInstanceSettings")
    private PersonalComputeInstanceSettings personalComputeInstanceSettings;

    /*
     * Details of customized scripts to execute for setting up the cluster.
     */
    @JsonProperty(value = "setupScripts")
    private SetupScripts setupScripts;

    /*
     * The last operation on ComputeInstance.
     */
    @JsonProperty(value = "lastOperation", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeInstanceLastOperation lastOperation;

    /*
     * The list of schedules to be applied on the computes.
     */
    @JsonProperty(value = "schedules", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeSchedules schedules;

    /*
     * Enable node public IP.
     *
     * Enable or disable node public IP address provisioning. Possible values are: Possible values are: true -
     * Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will
     * have a private endpoint and no public IPs.
     */
    @JsonProperty(value = "enableNodePublicIp")
    private Boolean enableNodePublicIp;

    /*
     * Describes informations of containers on this ComputeInstance.
     */
    @JsonProperty(value = "containers", access = JsonProperty.Access.WRITE_ONLY)
    private List<ComputeInstanceContainer> containers;

    /*
     * Describes informations of dataDisks on this ComputeInstance.
     */
    @JsonProperty(value = "dataDisks", access = JsonProperty.Access.WRITE_ONLY)
    private List<ComputeInstanceDataDisk> dataDisks;

    /*
     * Describes informations of dataMounts on this ComputeInstance.
     */
    @JsonProperty(value = "dataMounts", access = JsonProperty.Access.WRITE_ONLY)
    private List<ComputeInstanceDataMount> dataMounts;

    /*
     * ComputeInstance version.
     */
    @JsonProperty(value = "versions", access = JsonProperty.Access.WRITE_ONLY)
    private ComputeInstanceVersion versions;

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

    /**
     * Get the vmSize property: Virtual Machine Size.
     *
     * @return the vmSize value.
     */
    public String vmSize() {
        return this.vmSize;
    }

    /**
     * Set the vmSize property: Virtual Machine Size.
     *
     * @param vmSize the vmSize value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withVmSize(String vmSize) {
        this.vmSize = vmSize;
        return this;
    }

    /**
     * Get the subnet property: Virtual network subnet resource ID the compute nodes belong to.
     *
     * @return the subnet value.
     */
    public ResourceId subnet() {
        return this.subnet;
    }

    /**
     * Set the subnet property: Virtual network subnet resource ID the compute nodes belong to.
     *
     * @param subnet the subnet value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withSubnet(ResourceId subnet) {
        this.subnet = subnet;
        return this;
    }

    /**
     * Get the applicationSharingPolicy property: Sharing policy for applications on this compute instance
     *
     * <p>Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only
     * the creator can access applications on this compute instance. When Shared, any workspace user can access
     * applications on this instance depending on his/her assigned role.
     *
     * @return the applicationSharingPolicy value.
     */
    public ApplicationSharingPolicy applicationSharingPolicy() {
        return this.applicationSharingPolicy;
    }

    /**
     * Set the applicationSharingPolicy property: Sharing policy for applications on this compute instance
     *
     * <p>Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only
     * the creator can access applications on this compute instance. When Shared, any workspace user can access
     * applications on this instance depending on his/her assigned role.
     *
     * @param applicationSharingPolicy the applicationSharingPolicy value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withApplicationSharingPolicy(ApplicationSharingPolicy applicationSharingPolicy) {
        this.applicationSharingPolicy = applicationSharingPolicy;
        return this;
    }

    /**
     * Get the sshSettings property: Specifies policy and settings for SSH access.
     *
     * @return the sshSettings value.
     */
    public ComputeInstanceSshSettings sshSettings() {
        return this.sshSettings;
    }

    /**
     * Set the sshSettings property: Specifies policy and settings for SSH access.
     *
     * @param sshSettings the sshSettings value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withSshSettings(ComputeInstanceSshSettings sshSettings) {
        this.sshSettings = sshSettings;
        return this;
    }

    /**
     * Get the connectivityEndpoints property: Describes all connectivity endpoints available for this ComputeInstance.
     *
     * @return the connectivityEndpoints value.
     */
    public ComputeInstanceConnectivityEndpoints connectivityEndpoints() {
        return this.connectivityEndpoints;
    }

    /**
     * Get the applications property: Describes available applications and their endpoints on this ComputeInstance.
     *
     * @return the applications value.
     */
    public List<ComputeInstanceApplication> applications() {
        return this.applications;
    }

    /**
     * Get the createdBy property: Describes information on user who created this ComputeInstance.
     *
     * @return the createdBy value.
     */
    public ComputeInstanceCreatedBy createdBy() {
        return this.createdBy;
    }

    /**
     * Get the errors property: Errors.
     *
     * <p>Collection of errors encountered on this ComputeInstance.
     *
     * @return the errors value.
     */
    public List<ManagementError> errors() {
        return this.errors;
    }

    /**
     * Get the state property: The current state of this ComputeInstance.
     *
     * @return the state value.
     */
    public ComputeInstanceState state() {
        return this.state;
    }

    /**
     * Get the computeInstanceAuthorizationType property: Compute Instance Authorization type.
     *
     * <p>The Compute Instance Authorization type. Available values are personal (default).
     *
     * @return the computeInstanceAuthorizationType value.
     */
    public ComputeInstanceAuthorizationType computeInstanceAuthorizationType() {
        return this.computeInstanceAuthorizationType;
    }

    /**
     * Set the computeInstanceAuthorizationType property: Compute Instance Authorization type.
     *
     * <p>The Compute Instance Authorization type. Available values are personal (default).
     *
     * @param computeInstanceAuthorizationType the computeInstanceAuthorizationType value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withComputeInstanceAuthorizationType(
        ComputeInstanceAuthorizationType computeInstanceAuthorizationType) {
        this.computeInstanceAuthorizationType = computeInstanceAuthorizationType;
        return this;
    }

    /**
     * Get the personalComputeInstanceSettings property: Settings for a personal compute instance.
     *
     * @return the personalComputeInstanceSettings value.
     */
    public PersonalComputeInstanceSettings personalComputeInstanceSettings() {
        return this.personalComputeInstanceSettings;
    }

    /**
     * Set the personalComputeInstanceSettings property: Settings for a personal compute instance.
     *
     * @param personalComputeInstanceSettings the personalComputeInstanceSettings value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withPersonalComputeInstanceSettings(
        PersonalComputeInstanceSettings personalComputeInstanceSettings) {
        this.personalComputeInstanceSettings = personalComputeInstanceSettings;
        return this;
    }

    /**
     * Get the setupScripts property: Details of customized scripts to execute for setting up the cluster.
     *
     * @return the setupScripts value.
     */
    public SetupScripts setupScripts() {
        return this.setupScripts;
    }

    /**
     * Set the setupScripts property: Details of customized scripts to execute for setting up the cluster.
     *
     * @param setupScripts the setupScripts value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withSetupScripts(SetupScripts setupScripts) {
        this.setupScripts = setupScripts;
        return this;
    }

    /**
     * Get the lastOperation property: The last operation on ComputeInstance.
     *
     * @return the lastOperation value.
     */
    public ComputeInstanceLastOperation lastOperation() {
        return this.lastOperation;
    }

    /**
     * Get the schedules property: The list of schedules to be applied on the computes.
     *
     * @return the schedules value.
     */
    public ComputeSchedules schedules() {
        return this.schedules;
    }

    /**
     * Get the enableNodePublicIp property: Enable node public IP.
     *
     * <p>Enable or disable node public IP address provisioning. Possible values are: Possible values are: true -
     * Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will
     * have a private endpoint and no public IPs.
     *
     * @return the enableNodePublicIp value.
     */
    public Boolean enableNodePublicIp() {
        return this.enableNodePublicIp;
    }

    /**
     * Set the enableNodePublicIp property: Enable node public IP.
     *
     * <p>Enable or disable node public IP address provisioning. Possible values are: Possible values are: true -
     * Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will
     * have a private endpoint and no public IPs.
     *
     * @param enableNodePublicIp the enableNodePublicIp value to set.
     * @return the ComputeInstanceProperties object itself.
     */
    public ComputeInstanceProperties withEnableNodePublicIp(Boolean enableNodePublicIp) {
        this.enableNodePublicIp = enableNodePublicIp;
        return this;
    }

    /**
     * Get the containers property: Describes informations of containers on this ComputeInstance.
     *
     * @return the containers value.
     */
    public List<ComputeInstanceContainer> containers() {
        return this.containers;
    }

    /**
     * Get the dataDisks property: Describes informations of dataDisks on this ComputeInstance.
     *
     * @return the dataDisks value.
     */
    public List<ComputeInstanceDataDisk> dataDisks() {
        return this.dataDisks;
    }

    /**
     * Get the dataMounts property: Describes informations of dataMounts on this ComputeInstance.
     *
     * @return the dataMounts value.
     */
    public List<ComputeInstanceDataMount> dataMounts() {
        return this.dataMounts;
    }

    /**
     * Get the versions property: ComputeInstance version.
     *
     * @return the versions value.
     */
    public ComputeInstanceVersion versions() {
        return this.versions;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (subnet() != null) {
            subnet().validate();
        }
        if (sshSettings() != null) {
            sshSettings().validate();
        }
        if (connectivityEndpoints() != null) {
            connectivityEndpoints().validate();
        }
        if (applications() != null) {
            applications().forEach(e -> e.validate());
        }
        if (createdBy() != null) {
            createdBy().validate();
        }
        if (personalComputeInstanceSettings() != null) {
            personalComputeInstanceSettings().validate();
        }
        if (setupScripts() != null) {
            setupScripts().validate();
        }
        if (lastOperation() != null) {
            lastOperation().validate();
        }
        if (schedules() != null) {
            schedules().validate();
        }
        if (containers() != null) {
            containers().forEach(e -> e.validate());
        }
        if (dataDisks() != null) {
            dataDisks().forEach(e -> e.validate());
        }
        if (dataMounts() != null) {
            dataMounts().forEach(e -> e.validate());
        }
        if (versions() != null) {
            versions().validate();
        }
    }
}
