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

package com.azure.resourcemanager.databox.models;

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

/** Configuration for defining the transfer of data. */
@Fluent
public final class TransferConfiguration {
    /*
     * Type of the configuration for transfer.
     */
    @JsonProperty(value = "transferConfigurationType", required = true)
    private TransferConfigurationType transferConfigurationType;

    /*
     * Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is
     * given as TransferUsingFilter.
     */
    @JsonProperty(value = "transferFilterDetails")
    private TransferConfigurationTransferFilterDetails transferFilterDetails;

    /*
     * Map of filter type and the details to transfer all data. This field is required only if the
     * TransferConfigurationType is given as TransferAll
     */
    @JsonProperty(value = "transferAllDetails")
    private TransferConfigurationTransferAllDetails transferAllDetails;

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

    /**
     * Get the transferConfigurationType property: Type of the configuration for transfer.
     *
     * @return the transferConfigurationType value.
     */
    public TransferConfigurationType transferConfigurationType() {
        return this.transferConfigurationType;
    }

    /**
     * Set the transferConfigurationType property: Type of the configuration for transfer.
     *
     * @param transferConfigurationType the transferConfigurationType value to set.
     * @return the TransferConfiguration object itself.
     */
    public TransferConfiguration withTransferConfigurationType(TransferConfigurationType transferConfigurationType) {
        this.transferConfigurationType = transferConfigurationType;
        return this;
    }

    /**
     * Get the transferFilterDetails property: Map of filter type and the details to filter. This field is required only
     * if the TransferConfigurationType is given as TransferUsingFilter.
     *
     * @return the transferFilterDetails value.
     */
    public TransferConfigurationTransferFilterDetails transferFilterDetails() {
        return this.transferFilterDetails;
    }

    /**
     * Set the transferFilterDetails property: Map of filter type and the details to filter. This field is required only
     * if the TransferConfigurationType is given as TransferUsingFilter.
     *
     * @param transferFilterDetails the transferFilterDetails value to set.
     * @return the TransferConfiguration object itself.
     */
    public TransferConfiguration withTransferFilterDetails(
        TransferConfigurationTransferFilterDetails transferFilterDetails) {
        this.transferFilterDetails = transferFilterDetails;
        return this;
    }

    /**
     * Get the transferAllDetails property: Map of filter type and the details to transfer all data. This field is
     * required only if the TransferConfigurationType is given as TransferAll.
     *
     * @return the transferAllDetails value.
     */
    public TransferConfigurationTransferAllDetails transferAllDetails() {
        return this.transferAllDetails;
    }

    /**
     * Set the transferAllDetails property: Map of filter type and the details to transfer all data. This field is
     * required only if the TransferConfigurationType is given as TransferAll.
     *
     * @param transferAllDetails the transferAllDetails value to set.
     * @return the TransferConfiguration object itself.
     */
    public TransferConfiguration withTransferAllDetails(TransferConfigurationTransferAllDetails transferAllDetails) {
        this.transferAllDetails = transferAllDetails;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (transferConfigurationType() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property transferConfigurationType in model TransferConfiguration"));
        }
        if (transferFilterDetails() != null) {
            transferFilterDetails().validate();
        }
        if (transferAllDetails() != null) {
            transferAllDetails().validate();
        }
    }

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