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

package com.azure.resourcemanager.recoveryservicesbackup.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Simple policy retention. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "retentionPolicyType")
@JsonTypeName("SimpleRetentionPolicy")
@Fluent
public final class SimpleRetentionPolicy extends RetentionPolicy {
    /*
     * Retention duration of the protection policy.
     */
    @JsonProperty(value = "retentionDuration")
    private RetentionDuration retentionDuration;

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

    /**
     * Get the retentionDuration property: Retention duration of the protection policy.
     *
     * @return the retentionDuration value.
     */
    public RetentionDuration retentionDuration() {
        return this.retentionDuration;
    }

    /**
     * Set the retentionDuration property: Retention duration of the protection policy.
     *
     * @param retentionDuration the retentionDuration value to set.
     * @return the SimpleRetentionPolicy object itself.
     */
    public SimpleRetentionPolicy withRetentionDuration(RetentionDuration retentionDuration) {
        this.retentionDuration = retentionDuration;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (retentionDuration() != null) {
            retentionDuration().validate();
        }
    }
}
