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

/** Long term retention policy. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "retentionPolicyType")
@JsonTypeName("LongTermRetentionPolicy")
@Fluent
public final class LongTermRetentionPolicy extends RetentionPolicy {
    /*
     * Daily retention schedule of the protection policy.
     */
    @JsonProperty(value = "dailySchedule")
    private DailyRetentionSchedule dailySchedule;

    /*
     * Weekly retention schedule of the protection policy.
     */
    @JsonProperty(value = "weeklySchedule")
    private WeeklyRetentionSchedule weeklySchedule;

    /*
     * Monthly retention schedule of the protection policy.
     */
    @JsonProperty(value = "monthlySchedule")
    private MonthlyRetentionSchedule monthlySchedule;

    /*
     * Yearly retention schedule of the protection policy.
     */
    @JsonProperty(value = "yearlySchedule")
    private YearlyRetentionSchedule yearlySchedule;

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

    /**
     * Get the dailySchedule property: Daily retention schedule of the protection policy.
     *
     * @return the dailySchedule value.
     */
    public DailyRetentionSchedule dailySchedule() {
        return this.dailySchedule;
    }

    /**
     * Set the dailySchedule property: Daily retention schedule of the protection policy.
     *
     * @param dailySchedule the dailySchedule value to set.
     * @return the LongTermRetentionPolicy object itself.
     */
    public LongTermRetentionPolicy withDailySchedule(DailyRetentionSchedule dailySchedule) {
        this.dailySchedule = dailySchedule;
        return this;
    }

    /**
     * Get the weeklySchedule property: Weekly retention schedule of the protection policy.
     *
     * @return the weeklySchedule value.
     */
    public WeeklyRetentionSchedule weeklySchedule() {
        return this.weeklySchedule;
    }

    /**
     * Set the weeklySchedule property: Weekly retention schedule of the protection policy.
     *
     * @param weeklySchedule the weeklySchedule value to set.
     * @return the LongTermRetentionPolicy object itself.
     */
    public LongTermRetentionPolicy withWeeklySchedule(WeeklyRetentionSchedule weeklySchedule) {
        this.weeklySchedule = weeklySchedule;
        return this;
    }

    /**
     * Get the monthlySchedule property: Monthly retention schedule of the protection policy.
     *
     * @return the monthlySchedule value.
     */
    public MonthlyRetentionSchedule monthlySchedule() {
        return this.monthlySchedule;
    }

    /**
     * Set the monthlySchedule property: Monthly retention schedule of the protection policy.
     *
     * @param monthlySchedule the monthlySchedule value to set.
     * @return the LongTermRetentionPolicy object itself.
     */
    public LongTermRetentionPolicy withMonthlySchedule(MonthlyRetentionSchedule monthlySchedule) {
        this.monthlySchedule = monthlySchedule;
        return this;
    }

    /**
     * Get the yearlySchedule property: Yearly retention schedule of the protection policy.
     *
     * @return the yearlySchedule value.
     */
    public YearlyRetentionSchedule yearlySchedule() {
        return this.yearlySchedule;
    }

    /**
     * Set the yearlySchedule property: Yearly retention schedule of the protection policy.
     *
     * @param yearlySchedule the yearlySchedule value to set.
     * @return the LongTermRetentionPolicy object itself.
     */
    public LongTermRetentionPolicy withYearlySchedule(YearlyRetentionSchedule yearlySchedule) {
        this.yearlySchedule = yearlySchedule;
        return this;
    }

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