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

/** The V2 policy schedule for IaaS that supports hourly backups. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "schedulePolicyType")
@JsonTypeName("SimpleSchedulePolicyV2")
@Fluent
public final class SimpleSchedulePolicyV2 extends SchedulePolicy {
    /*
     * Frequency of the schedule operation of this policy.
     */
    @JsonProperty(value = "scheduleRunFrequency")
    private ScheduleRunType scheduleRunFrequency;

    /*
     * hourly schedule of this policy
     */
    @JsonProperty(value = "hourlySchedule")
    private HourlySchedule hourlySchedule;

    /*
     * Daily schedule of this policy
     */
    @JsonProperty(value = "dailySchedule")
    private DailySchedule dailySchedule;

    /*
     * Weekly schedule of this policy
     */
    @JsonProperty(value = "weeklySchedule")
    private WeeklySchedule weeklySchedule;

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

    /**
     * Get the scheduleRunFrequency property: Frequency of the schedule operation of this policy.
     *
     * @return the scheduleRunFrequency value.
     */
    public ScheduleRunType scheduleRunFrequency() {
        return this.scheduleRunFrequency;
    }

    /**
     * Set the scheduleRunFrequency property: Frequency of the schedule operation of this policy.
     *
     * @param scheduleRunFrequency the scheduleRunFrequency value to set.
     * @return the SimpleSchedulePolicyV2 object itself.
     */
    public SimpleSchedulePolicyV2 withScheduleRunFrequency(ScheduleRunType scheduleRunFrequency) {
        this.scheduleRunFrequency = scheduleRunFrequency;
        return this;
    }

    /**
     * Get the hourlySchedule property: hourly schedule of this policy.
     *
     * @return the hourlySchedule value.
     */
    public HourlySchedule hourlySchedule() {
        return this.hourlySchedule;
    }

    /**
     * Set the hourlySchedule property: hourly schedule of this policy.
     *
     * @param hourlySchedule the hourlySchedule value to set.
     * @return the SimpleSchedulePolicyV2 object itself.
     */
    public SimpleSchedulePolicyV2 withHourlySchedule(HourlySchedule hourlySchedule) {
        this.hourlySchedule = hourlySchedule;
        return this;
    }

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

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

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

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

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