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

package com.azure.resourcemanager.postgresqlflexibleserver.models;

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

/** The request that is made for a long term retention backup. */
@Fluent
public final class LtrBackupRequest extends BackupRequestBase {
    /*
     * Backup store detail for target server
     */
    @JsonProperty(value = "targetDetails", required = true)
    private BackupStoreDetails targetDetails;

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

    /**
     * Get the targetDetails property: Backup store detail for target server.
     *
     * @return the targetDetails value.
     */
    public BackupStoreDetails targetDetails() {
        return this.targetDetails;
    }

    /**
     * Set the targetDetails property: Backup store detail for target server.
     *
     * @param targetDetails the targetDetails value to set.
     * @return the LtrBackupRequest object itself.
     */
    public LtrBackupRequest withTargetDetails(BackupStoreDetails targetDetails) {
        this.targetDetails = targetDetails;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public LtrBackupRequest withBackupSettings(BackupSettings backupSettings) {
        super.withBackupSettings(backupSettings);
        return this;
    }

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

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