// 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;

/**
 * TargetCopySetting
 *
 * <p>Target copy settings.
 */
@Fluent
public final class TargetCopySetting {
    /*
     * CopyOption
     *
     * It can be CustomCopyOption or ImmediateCopyOption.
     */
    @JsonProperty(value = "copyAfter", required = true)
    private CopyOption copyAfter;

    /*
     * DataStoreInfoBase
     *
     * Info of target datastore
     */
    @JsonProperty(value = "dataStore", required = true)
    private DataStoreInfoBase dataStore;

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

    /**
     * Get the copyAfter property: CopyOption
     *
     * <p>It can be CustomCopyOption or ImmediateCopyOption.
     *
     * @return the copyAfter value.
     */
    public CopyOption copyAfter() {
        return this.copyAfter;
    }

    /**
     * Set the copyAfter property: CopyOption
     *
     * <p>It can be CustomCopyOption or ImmediateCopyOption.
     *
     * @param copyAfter the copyAfter value to set.
     * @return the TargetCopySetting object itself.
     */
    public TargetCopySetting withCopyAfter(CopyOption copyAfter) {
        this.copyAfter = copyAfter;
        return this;
    }

    /**
     * Get the dataStore property: DataStoreInfoBase
     *
     * <p>Info of target datastore.
     *
     * @return the dataStore value.
     */
    public DataStoreInfoBase dataStore() {
        return this.dataStore;
    }

    /**
     * Set the dataStore property: DataStoreInfoBase
     *
     * <p>Info of target datastore.
     *
     * @param dataStore the dataStore value to set.
     * @return the TargetCopySetting object itself.
     */
    public TargetCopySetting withDataStore(DataStoreInfoBase dataStore) {
        this.dataStore = dataStore;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (copyAfter() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property copyAfter in model TargetCopySetting"));
        } else {
            copyAfter().validate();
        }
        if (dataStore() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property dataStore in model TargetCopySetting"));
        } else {
            dataStore().validate();
        }
    }

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