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

package com.azure.resourcemanager.dataprotection.models;

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

/**
 * BackupVault
 *
 * <p>Backup Vault.
 */
@Fluent
public final class BackupVault {
    /*
     * Monitoring Settings
     */
    @JsonProperty(value = "monitoringSettings")
    private MonitoringSettings monitoringSettings;

    /*
     * Provisioning state of the BackupVault resource
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * Resource move state for backup vault
     */
    @JsonProperty(value = "resourceMoveState", access = JsonProperty.Access.WRITE_ONLY)
    private ResourceMoveState resourceMoveState;

    /*
     * Resource move details for backup vault
     */
    @JsonProperty(value = "resourceMoveDetails", access = JsonProperty.Access.WRITE_ONLY)
    private ResourceMoveDetails resourceMoveDetails;

    /*
     * Security Settings
     */
    @JsonProperty(value = "securitySettings")
    private SecuritySettings securitySettings;

    /*
     * Storage Settings
     */
    @JsonProperty(value = "storageSettings", required = true)
    private List<StorageSetting> storageSettings;

    /*
     * Is vault protected by resource guard
     */
    @JsonProperty(value = "isVaultProtectedByResourceGuard", access = JsonProperty.Access.WRITE_ONLY)
    private Boolean isVaultProtectedByResourceGuard;

    /*
     * Feature Settings
     */
    @JsonProperty(value = "featureSettings")
    private FeatureSettings featureSettings;

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

    /**
     * Get the monitoringSettings property: Monitoring Settings.
     *
     * @return the monitoringSettings value.
     */
    public MonitoringSettings monitoringSettings() {
        return this.monitoringSettings;
    }

    /**
     * Set the monitoringSettings property: Monitoring Settings.
     *
     * @param monitoringSettings the monitoringSettings value to set.
     * @return the BackupVault object itself.
     */
    public BackupVault withMonitoringSettings(MonitoringSettings monitoringSettings) {
        this.monitoringSettings = monitoringSettings;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the BackupVault resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the resourceMoveState property: Resource move state for backup vault.
     *
     * @return the resourceMoveState value.
     */
    public ResourceMoveState resourceMoveState() {
        return this.resourceMoveState;
    }

    /**
     * Get the resourceMoveDetails property: Resource move details for backup vault.
     *
     * @return the resourceMoveDetails value.
     */
    public ResourceMoveDetails resourceMoveDetails() {
        return this.resourceMoveDetails;
    }

    /**
     * Get the securitySettings property: Security Settings.
     *
     * @return the securitySettings value.
     */
    public SecuritySettings securitySettings() {
        return this.securitySettings;
    }

    /**
     * Set the securitySettings property: Security Settings.
     *
     * @param securitySettings the securitySettings value to set.
     * @return the BackupVault object itself.
     */
    public BackupVault withSecuritySettings(SecuritySettings securitySettings) {
        this.securitySettings = securitySettings;
        return this;
    }

    /**
     * Get the storageSettings property: Storage Settings.
     *
     * @return the storageSettings value.
     */
    public List<StorageSetting> storageSettings() {
        return this.storageSettings;
    }

    /**
     * Set the storageSettings property: Storage Settings.
     *
     * @param storageSettings the storageSettings value to set.
     * @return the BackupVault object itself.
     */
    public BackupVault withStorageSettings(List<StorageSetting> storageSettings) {
        this.storageSettings = storageSettings;
        return this;
    }

    /**
     * Get the isVaultProtectedByResourceGuard property: Is vault protected by resource guard.
     *
     * @return the isVaultProtectedByResourceGuard value.
     */
    public Boolean isVaultProtectedByResourceGuard() {
        return this.isVaultProtectedByResourceGuard;
    }

    /**
     * Get the featureSettings property: Feature Settings.
     *
     * @return the featureSettings value.
     */
    public FeatureSettings featureSettings() {
        return this.featureSettings;
    }

    /**
     * Set the featureSettings property: Feature Settings.
     *
     * @param featureSettings the featureSettings value to set.
     * @return the BackupVault object itself.
     */
    public BackupVault withFeatureSettings(FeatureSettings featureSettings) {
        this.featureSettings = featureSettings;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (monitoringSettings() != null) {
            monitoringSettings().validate();
        }
        if (resourceMoveDetails() != null) {
            resourceMoveDetails().validate();
        }
        if (securitySettings() != null) {
            securitySettings().validate();
        }
        if (storageSettings() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property storageSettings in model BackupVault"));
        } else {
            storageSettings().forEach(e -> e.validate());
        }
        if (featureSettings() != null) {
            featureSettings().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(BackupVault.class);
}
