// 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 com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * AzureBackupDiscreteRecoveryPoint
 *
 * <p>Azure backup discrete RecoveryPoint.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType")
@JsonTypeName("AzureBackupDiscreteRecoveryPoint")
@Fluent
public final class AzureBackupDiscreteRecoveryPoint extends AzureBackupRecoveryPoint {
    /*
     * The friendlyName property.
     */
    @JsonProperty(value = "friendlyName")
    private String friendlyName;

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

    /*
     * The recoveryPointTime property.
     */
    @JsonProperty(value = "recoveryPointTime", required = true)
    private OffsetDateTime recoveryPointTime;

    /*
     * The policyName property.
     */
    @JsonProperty(value = "policyName")
    private String policyName;

    /*
     * The policyVersion property.
     */
    @JsonProperty(value = "policyVersion")
    private String policyVersion;

    /*
     * The recoveryPointId property.
     */
    @JsonProperty(value = "recoveryPointId")
    private String recoveryPointId;

    /*
     * The recoveryPointType property.
     */
    @JsonProperty(value = "recoveryPointType")
    private String recoveryPointType;

    /*
     * The retentionTagName property.
     */
    @JsonProperty(value = "retentionTagName")
    private String retentionTagName;

    /*
     * The retentionTagVersion property.
     */
    @JsonProperty(value = "retentionTagVersion")
    private String retentionTagVersion;

    /*
     * The expiryTime property.
     */
    @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime expiryTime;

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

    /**
     * Get the friendlyName property: The friendlyName property.
     *
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.friendlyName;
    }

    /**
     * Set the friendlyName property: The friendlyName property.
     *
     * @param friendlyName the friendlyName value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withFriendlyName(String friendlyName) {
        this.friendlyName = friendlyName;
        return this;
    }

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

    /**
     * Set the recoveryPointDataStoresDetails property: The recoveryPointDataStoresDetails property.
     *
     * @param recoveryPointDataStoresDetails the recoveryPointDataStoresDetails value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRecoveryPointDataStoresDetails(
        List<RecoveryPointDataStoreDetails> recoveryPointDataStoresDetails) {
        this.recoveryPointDataStoresDetails = recoveryPointDataStoresDetails;
        return this;
    }

    /**
     * Get the recoveryPointTime property: The recoveryPointTime property.
     *
     * @return the recoveryPointTime value.
     */
    public OffsetDateTime recoveryPointTime() {
        return this.recoveryPointTime;
    }

    /**
     * Set the recoveryPointTime property: The recoveryPointTime property.
     *
     * @param recoveryPointTime the recoveryPointTime value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRecoveryPointTime(OffsetDateTime recoveryPointTime) {
        this.recoveryPointTime = recoveryPointTime;
        return this;
    }

    /**
     * Get the policyName property: The policyName property.
     *
     * @return the policyName value.
     */
    public String policyName() {
        return this.policyName;
    }

    /**
     * Set the policyName property: The policyName property.
     *
     * @param policyName the policyName value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withPolicyName(String policyName) {
        this.policyName = policyName;
        return this;
    }

    /**
     * Get the policyVersion property: The policyVersion property.
     *
     * @return the policyVersion value.
     */
    public String policyVersion() {
        return this.policyVersion;
    }

    /**
     * Set the policyVersion property: The policyVersion property.
     *
     * @param policyVersion the policyVersion value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withPolicyVersion(String policyVersion) {
        this.policyVersion = policyVersion;
        return this;
    }

    /**
     * Get the recoveryPointId property: The recoveryPointId property.
     *
     * @return the recoveryPointId value.
     */
    public String recoveryPointId() {
        return this.recoveryPointId;
    }

    /**
     * Set the recoveryPointId property: The recoveryPointId property.
     *
     * @param recoveryPointId the recoveryPointId value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRecoveryPointId(String recoveryPointId) {
        this.recoveryPointId = recoveryPointId;
        return this;
    }

    /**
     * Get the recoveryPointType property: The recoveryPointType property.
     *
     * @return the recoveryPointType value.
     */
    public String recoveryPointType() {
        return this.recoveryPointType;
    }

    /**
     * Set the recoveryPointType property: The recoveryPointType property.
     *
     * @param recoveryPointType the recoveryPointType value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRecoveryPointType(String recoveryPointType) {
        this.recoveryPointType = recoveryPointType;
        return this;
    }

    /**
     * Get the retentionTagName property: The retentionTagName property.
     *
     * @return the retentionTagName value.
     */
    public String retentionTagName() {
        return this.retentionTagName;
    }

    /**
     * Set the retentionTagName property: The retentionTagName property.
     *
     * @param retentionTagName the retentionTagName value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRetentionTagName(String retentionTagName) {
        this.retentionTagName = retentionTagName;
        return this;
    }

    /**
     * Get the retentionTagVersion property: The retentionTagVersion property.
     *
     * @return the retentionTagVersion value.
     */
    public String retentionTagVersion() {
        return this.retentionTagVersion;
    }

    /**
     * Set the retentionTagVersion property: The retentionTagVersion property.
     *
     * @param retentionTagVersion the retentionTagVersion value to set.
     * @return the AzureBackupDiscreteRecoveryPoint object itself.
     */
    public AzureBackupDiscreteRecoveryPoint withRetentionTagVersion(String retentionTagVersion) {
        this.retentionTagVersion = retentionTagVersion;
        return this;
    }

    /**
     * Get the expiryTime property: The expiryTime property.
     *
     * @return the expiryTime value.
     */
    public OffsetDateTime expiryTime() {
        return this.expiryTime;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (recoveryPointDataStoresDetails() != null) {
            recoveryPointDataStoresDetails().forEach(e -> e.validate());
        }
        if (recoveryPointTime() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property recoveryPointTime in model AzureBackupDiscreteRecoveryPoint"));
        }
    }

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