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

package com.azure.resourcemanager.storagecache.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.storagecache.models.CacheDirectorySettings;
import com.azure.resourcemanager.storagecache.models.CacheEncryptionSettings;
import com.azure.resourcemanager.storagecache.models.CacheHealth;
import com.azure.resourcemanager.storagecache.models.CacheNetworkSettings;
import com.azure.resourcemanager.storagecache.models.CacheSecuritySettings;
import com.azure.resourcemanager.storagecache.models.CacheUpgradeSettings;
import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus;
import com.azure.resourcemanager.storagecache.models.PrimingJob;
import com.azure.resourcemanager.storagecache.models.ProvisioningStateType;
import com.azure.resourcemanager.storagecache.models.StorageTargetSpaceAllocation;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Properties of the cache. */
@Fluent
public final class CacheProperties {
    /*
     * The size of this Cache, in GB.
     */
    @JsonProperty(value = "cacheSizeGB")
    private Integer cacheSizeGB;

    /*
     * Health of the cache.
     */
    @JsonProperty(value = "health", access = JsonProperty.Access.WRITE_ONLY)
    private CacheHealth health;

    /*
     * Array of IPv4 addresses that can be used by clients mounting this cache.
     */
    @JsonProperty(value = "mountAddresses", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> mountAddresses;

    /*
     * ARM provisioning state, see
     * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningStateType provisioningState;

    /*
     * Subnet used for the cache.
     */
    @JsonProperty(value = "subnet")
    private String subnet;

    /*
     * Upgrade status of the cache.
     */
    @JsonProperty(value = "upgradeStatus", access = JsonProperty.Access.WRITE_ONLY)
    private CacheUpgradeStatus upgradeStatus;

    /*
     * Upgrade settings of the cache.
     */
    @JsonProperty(value = "upgradeSettings")
    private CacheUpgradeSettings upgradeSettings;

    /*
     * Specifies network settings of the cache.
     */
    @JsonProperty(value = "networkSettings")
    private CacheNetworkSettings networkSettings;

    /*
     * Specifies encryption settings of the cache.
     */
    @JsonProperty(value = "encryptionSettings")
    private CacheEncryptionSettings encryptionSettings;

    /*
     * Specifies security settings of the cache.
     */
    @JsonProperty(value = "securitySettings")
    private CacheSecuritySettings securitySettings;

    /*
     * Specifies Directory Services settings of the cache.
     */
    @JsonProperty(value = "directoryServicesSettings")
    private CacheDirectorySettings directoryServicesSettings;

    /*
     * Availability zones for resources. This field should only contain a single element in the array.
     */
    @JsonProperty(value = "zones")
    private List<String> zones;

    /*
     * Specifies the priming jobs defined in the cache.
     */
    @JsonProperty(value = "primingJobs", access = JsonProperty.Access.WRITE_ONLY)
    private List<PrimingJob> primingJobs;

    /*
     * Specifies the space allocation percentage for each storage target in the cache.
     */
    @JsonProperty(value = "spaceAllocation", access = JsonProperty.Access.WRITE_ONLY)
    private List<StorageTargetSpaceAllocation> spaceAllocation;

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

    /**
     * Get the cacheSizeGB property: The size of this Cache, in GB.
     *
     * @return the cacheSizeGB value.
     */
    public Integer cacheSizeGB() {
        return this.cacheSizeGB;
    }

    /**
     * Set the cacheSizeGB property: The size of this Cache, in GB.
     *
     * @param cacheSizeGB the cacheSizeGB value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withCacheSizeGB(Integer cacheSizeGB) {
        this.cacheSizeGB = cacheSizeGB;
        return this;
    }

    /**
     * Get the health property: Health of the cache.
     *
     * @return the health value.
     */
    public CacheHealth health() {
        return this.health;
    }

    /**
     * Get the mountAddresses property: Array of IPv4 addresses that can be used by clients mounting this cache.
     *
     * @return the mountAddresses value.
     */
    public List<String> mountAddresses() {
        return this.mountAddresses;
    }

    /**
     * Get the provisioningState property: ARM provisioning state, see
     * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property.
     *
     * @return the provisioningState value.
     */
    public ProvisioningStateType provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the subnet property: Subnet used for the cache.
     *
     * @return the subnet value.
     */
    public String subnet() {
        return this.subnet;
    }

    /**
     * Set the subnet property: Subnet used for the cache.
     *
     * @param subnet the subnet value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withSubnet(String subnet) {
        this.subnet = subnet;
        return this;
    }

    /**
     * Get the upgradeStatus property: Upgrade status of the cache.
     *
     * @return the upgradeStatus value.
     */
    public CacheUpgradeStatus upgradeStatus() {
        return this.upgradeStatus;
    }

    /**
     * Get the upgradeSettings property: Upgrade settings of the cache.
     *
     * @return the upgradeSettings value.
     */
    public CacheUpgradeSettings upgradeSettings() {
        return this.upgradeSettings;
    }

    /**
     * Set the upgradeSettings property: Upgrade settings of the cache.
     *
     * @param upgradeSettings the upgradeSettings value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withUpgradeSettings(CacheUpgradeSettings upgradeSettings) {
        this.upgradeSettings = upgradeSettings;
        return this;
    }

    /**
     * Get the networkSettings property: Specifies network settings of the cache.
     *
     * @return the networkSettings value.
     */
    public CacheNetworkSettings networkSettings() {
        return this.networkSettings;
    }

    /**
     * Set the networkSettings property: Specifies network settings of the cache.
     *
     * @param networkSettings the networkSettings value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withNetworkSettings(CacheNetworkSettings networkSettings) {
        this.networkSettings = networkSettings;
        return this;
    }

    /**
     * Get the encryptionSettings property: Specifies encryption settings of the cache.
     *
     * @return the encryptionSettings value.
     */
    public CacheEncryptionSettings encryptionSettings() {
        return this.encryptionSettings;
    }

    /**
     * Set the encryptionSettings property: Specifies encryption settings of the cache.
     *
     * @param encryptionSettings the encryptionSettings value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withEncryptionSettings(CacheEncryptionSettings encryptionSettings) {
        this.encryptionSettings = encryptionSettings;
        return this;
    }

    /**
     * Get the securitySettings property: Specifies security settings of the cache.
     *
     * @return the securitySettings value.
     */
    public CacheSecuritySettings securitySettings() {
        return this.securitySettings;
    }

    /**
     * Set the securitySettings property: Specifies security settings of the cache.
     *
     * @param securitySettings the securitySettings value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withSecuritySettings(CacheSecuritySettings securitySettings) {
        this.securitySettings = securitySettings;
        return this;
    }

    /**
     * Get the directoryServicesSettings property: Specifies Directory Services settings of the cache.
     *
     * @return the directoryServicesSettings value.
     */
    public CacheDirectorySettings directoryServicesSettings() {
        return this.directoryServicesSettings;
    }

    /**
     * Set the directoryServicesSettings property: Specifies Directory Services settings of the cache.
     *
     * @param directoryServicesSettings the directoryServicesSettings value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings) {
        this.directoryServicesSettings = directoryServicesSettings;
        return this;
    }

    /**
     * Get the zones property: Availability zones for resources. This field should only contain a single element in the
     * array.
     *
     * @return the zones value.
     */
    public List<String> zones() {
        return this.zones;
    }

    /**
     * Set the zones property: Availability zones for resources. This field should only contain a single element in the
     * array.
     *
     * @param zones the zones value to set.
     * @return the CacheProperties object itself.
     */
    public CacheProperties withZones(List<String> zones) {
        this.zones = zones;
        return this;
    }

    /**
     * Get the primingJobs property: Specifies the priming jobs defined in the cache.
     *
     * @return the primingJobs value.
     */
    public List<PrimingJob> primingJobs() {
        return this.primingJobs;
    }

    /**
     * Get the spaceAllocation property: Specifies the space allocation percentage for each storage target in the cache.
     *
     * @return the spaceAllocation value.
     */
    public List<StorageTargetSpaceAllocation> spaceAllocation() {
        return this.spaceAllocation;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (health() != null) {
            health().validate();
        }
        if (upgradeStatus() != null) {
            upgradeStatus().validate();
        }
        if (upgradeSettings() != null) {
            upgradeSettings().validate();
        }
        if (networkSettings() != null) {
            networkSettings().validate();
        }
        if (encryptionSettings() != null) {
            encryptionSettings().validate();
        }
        if (securitySettings() != null) {
            securitySettings().validate();
        }
        if (directoryServicesSettings() != null) {
            directoryServicesSettings().validate();
        }
        if (primingJobs() != null) {
            primingJobs().forEach(e -> e.validate());
        }
        if (spaceAllocation() != null) {
            spaceAllocation().forEach(e -> e.validate());
        }
    }
}
