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

package com.azure.resourcemanager.appcontainers.models;

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

/** Volume definitions for the Container App. */
@Fluent
public final class Volume {
    /*
     * Volume name.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Storage type for the volume. If not provided, use EmptyDir.
     */
    @JsonProperty(value = "storageType")
    private StorageType storageType;

    /*
     * Name of storage resource. No need to provide for EmptyDir and Secret.
     */
    @JsonProperty(value = "storageName")
    private String storageName;

    /*
     * List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to
     * volume.
     */
    @JsonProperty(value = "secrets")
    private List<SecretVolumeItem> secrets;

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

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

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

    /**
     * Get the storageType property: Storage type for the volume. If not provided, use EmptyDir.
     *
     * @return the storageType value.
     */
    public StorageType storageType() {
        return this.storageType;
    }

    /**
     * Set the storageType property: Storage type for the volume. If not provided, use EmptyDir.
     *
     * @param storageType the storageType value to set.
     * @return the Volume object itself.
     */
    public Volume withStorageType(StorageType storageType) {
        this.storageType = storageType;
        return this;
    }

    /**
     * Get the storageName property: Name of storage resource. No need to provide for EmptyDir and Secret.
     *
     * @return the storageName value.
     */
    public String storageName() {
        return this.storageName;
    }

    /**
     * Set the storageName property: Name of storage resource. No need to provide for EmptyDir and Secret.
     *
     * @param storageName the storageName value to set.
     * @return the Volume object itself.
     */
    public Volume withStorageName(String storageName) {
        this.storageName = storageName;
        return this;
    }

    /**
     * Get the secrets property: List of secrets to be added in volume. If no secrets are provided, all secrets in
     * collection will be added to volume.
     *
     * @return the secrets value.
     */
    public List<SecretVolumeItem> secrets() {
        return this.secrets;
    }

    /**
     * Set the secrets property: List of secrets to be added in volume. If no secrets are provided, all secrets in
     * collection will be added to volume.
     *
     * @param secrets the secrets value to set.
     * @return the Volume object itself.
     */
    public Volume withSecrets(List<SecretVolumeItem> secrets) {
        this.secrets = secrets;
        return this;
    }

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