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

/**
 * SourceLifeCycle
 *
 * <p>Source LifeCycle.
 */
@Fluent
public final class SourceLifeCycle {
    /*
     * DeleteOption
     *
     * Delete Option
     */
    @JsonProperty(value = "deleteAfter", required = true)
    private DeleteOption deleteAfter;

    /*
     * DataStoreInfoBase
     *
     * DataStoreInfo base
     */
    @JsonProperty(value = "sourceDataStore", required = true)
    private DataStoreInfoBase sourceDataStore;

    /*
     * The targetDataStoreCopySettings property.
     */
    @JsonProperty(value = "targetDataStoreCopySettings")
    private List<TargetCopySetting> targetDataStoreCopySettings;

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

    /**
     * Get the deleteAfter property: DeleteOption
     *
     * <p>Delete Option.
     *
     * @return the deleteAfter value.
     */
    public DeleteOption deleteAfter() {
        return this.deleteAfter;
    }

    /**
     * Set the deleteAfter property: DeleteOption
     *
     * <p>Delete Option.
     *
     * @param deleteAfter the deleteAfter value to set.
     * @return the SourceLifeCycle object itself.
     */
    public SourceLifeCycle withDeleteAfter(DeleteOption deleteAfter) {
        this.deleteAfter = deleteAfter;
        return this;
    }

    /**
     * Get the sourceDataStore property: DataStoreInfoBase
     *
     * <p>DataStoreInfo base.
     *
     * @return the sourceDataStore value.
     */
    public DataStoreInfoBase sourceDataStore() {
        return this.sourceDataStore;
    }

    /**
     * Set the sourceDataStore property: DataStoreInfoBase
     *
     * <p>DataStoreInfo base.
     *
     * @param sourceDataStore the sourceDataStore value to set.
     * @return the SourceLifeCycle object itself.
     */
    public SourceLifeCycle withSourceDataStore(DataStoreInfoBase sourceDataStore) {
        this.sourceDataStore = sourceDataStore;
        return this;
    }

    /**
     * Get the targetDataStoreCopySettings property: The targetDataStoreCopySettings property.
     *
     * @return the targetDataStoreCopySettings value.
     */
    public List<TargetCopySetting> targetDataStoreCopySettings() {
        return this.targetDataStoreCopySettings;
    }

    /**
     * Set the targetDataStoreCopySettings property: The targetDataStoreCopySettings property.
     *
     * @param targetDataStoreCopySettings the targetDataStoreCopySettings value to set.
     * @return the SourceLifeCycle object itself.
     */
    public SourceLifeCycle withTargetDataStoreCopySettings(List<TargetCopySetting> targetDataStoreCopySettings) {
        this.targetDataStoreCopySettings = targetDataStoreCopySettings;
        return this;
    }

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

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