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

package com.azure.resourcemanager.alertsmanagement.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Scheduling configuration for a given alert processing rule. */
@Fluent
public final class Schedule {
    /*
     * Scheduling effective from time. Date-Time in ISO-8601 format without timezone suffix.
     */
    @JsonProperty(value = "effectiveFrom")
    private String effectiveFrom;

    /*
     * Scheduling effective until time. Date-Time in ISO-8601 format without timezone suffix.
     */
    @JsonProperty(value = "effectiveUntil")
    private String effectiveUntil;

    /*
     * Scheduling time zone.
     */
    @JsonProperty(value = "timeZone")
    private String timeZone;

    /*
     * List of recurrences.
     */
    @JsonProperty(value = "recurrences")
    private List<Recurrence> recurrences;

    /**
     * Get the effectiveFrom property: Scheduling effective from time. Date-Time in ISO-8601 format without timezone
     * suffix.
     *
     * @return the effectiveFrom value.
     */
    public String effectiveFrom() {
        return this.effectiveFrom;
    }

    /**
     * Set the effectiveFrom property: Scheduling effective from time. Date-Time in ISO-8601 format without timezone
     * suffix.
     *
     * @param effectiveFrom the effectiveFrom value to set.
     * @return the Schedule object itself.
     */
    public Schedule withEffectiveFrom(String effectiveFrom) {
        this.effectiveFrom = effectiveFrom;
        return this;
    }

    /**
     * Get the effectiveUntil property: Scheduling effective until time. Date-Time in ISO-8601 format without timezone
     * suffix.
     *
     * @return the effectiveUntil value.
     */
    public String effectiveUntil() {
        return this.effectiveUntil;
    }

    /**
     * Set the effectiveUntil property: Scheduling effective until time. Date-Time in ISO-8601 format without timezone
     * suffix.
     *
     * @param effectiveUntil the effectiveUntil value to set.
     * @return the Schedule object itself.
     */
    public Schedule withEffectiveUntil(String effectiveUntil) {
        this.effectiveUntil = effectiveUntil;
        return this;
    }

    /**
     * Get the timeZone property: Scheduling time zone.
     *
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.timeZone;
    }

    /**
     * Set the timeZone property: Scheduling time zone.
     *
     * @param timeZone the timeZone value to set.
     * @return the Schedule object itself.
     */
    public Schedule withTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
    }

    /**
     * Get the recurrences property: List of recurrences.
     *
     * @return the recurrences value.
     */
    public List<Recurrence> recurrences() {
        return this.recurrences;
    }

    /**
     * Set the recurrences property: List of recurrences.
     *
     * @param recurrences the recurrences value to set.
     * @return the Schedule object itself.
     */
    public Schedule withRecurrences(List<Recurrence> recurrences) {
        this.recurrences = recurrences;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (recurrences() != null) {
            recurrences().forEach(e -> e.validate());
        }
    }
}
