// 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 java.util.List;

/**
 * BackupSchedule
 *
 * <p>Schedule for backup.
 */
@Fluent
public final class BackupSchedule {
    /*
     * ISO 8601 repeating time interval format
     */
    @JsonProperty(value = "repeatingTimeIntervals", required = true)
    private List<String> repeatingTimeIntervals;

    /*
     * Time zone for a schedule. Example: Pacific Standard Time
     */
    @JsonProperty(value = "timeZone")
    private String timeZone;

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

    /**
     * Get the repeatingTimeIntervals property: ISO 8601 repeating time interval format.
     *
     * @return the repeatingTimeIntervals value.
     */
    public List<String> repeatingTimeIntervals() {
        return this.repeatingTimeIntervals;
    }

    /**
     * Set the repeatingTimeIntervals property: ISO 8601 repeating time interval format.
     *
     * @param repeatingTimeIntervals the repeatingTimeIntervals value to set.
     * @return the BackupSchedule object itself.
     */
    public BackupSchedule withRepeatingTimeIntervals(List<String> repeatingTimeIntervals) {
        this.repeatingTimeIntervals = repeatingTimeIntervals;
        return this;
    }

    /**
     * Get the timeZone property: Time zone for a schedule. Example: Pacific Standard Time.
     *
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.timeZone;
    }

    /**
     * Set the timeZone property: Time zone for a schedule. Example: Pacific Standard Time.
     *
     * @param timeZone the timeZone value to set.
     * @return the BackupSchedule object itself.
     */
    public BackupSchedule withTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
    }

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

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