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

package com.azure.resourcemanager.labservices.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.labservices.models.ProvisioningState;
import com.azure.resourcemanager.labservices.models.RecurrencePattern;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Schedule for automatically turning virtual machines in a lab on and off at specified times. */
@Fluent
public final class ScheduleInner extends ProxyResource {
    /*
     * Metadata pertaining to creation and last modification of the schedule.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Schedule resource properties
     */
    @JsonProperty(value = "properties", required = true)
    private ScheduleProperties innerProperties = new ScheduleProperties();

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the schedule.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Schedule resource properties.
     *
     * @return the innerProperties value.
     */
    private ScheduleProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the provisioningState property: Current provisioning state of the schedule.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the startAt property: When lab user virtual machines will be started. Timestamp offsets will be ignored and
     * timeZoneId is used instead.
     *
     * @return the startAt value.
     */
    public OffsetDateTime startAt() {
        return this.innerProperties() == null ? null : this.innerProperties().startAt();
    }

    /**
     * Set the startAt property: When lab user virtual machines will be started. Timestamp offsets will be ignored and
     * timeZoneId is used instead.
     *
     * @param startAt the startAt value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withStartAt(OffsetDateTime startAt) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withStartAt(startAt);
        return this;
    }

    /**
     * Get the stopAt property: When lab user virtual machines will be stopped. Timestamp offsets will be ignored and
     * timeZoneId is used instead.
     *
     * @return the stopAt value.
     */
    public OffsetDateTime stopAt() {
        return this.innerProperties() == null ? null : this.innerProperties().stopAt();
    }

    /**
     * Set the stopAt property: When lab user virtual machines will be stopped. Timestamp offsets will be ignored and
     * timeZoneId is used instead.
     *
     * @param stopAt the stopAt value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withStopAt(OffsetDateTime stopAt) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withStopAt(stopAt);
        return this;
    }

    /**
     * Get the recurrencePattern property: The recurrence pattern of the scheduled actions.
     *
     * @return the recurrencePattern value.
     */
    public RecurrencePattern recurrencePattern() {
        return this.innerProperties() == null ? null : this.innerProperties().recurrencePattern();
    }

    /**
     * Set the recurrencePattern property: The recurrence pattern of the scheduled actions.
     *
     * @param recurrencePattern the recurrencePattern value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withRecurrencePattern(RecurrencePattern recurrencePattern) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withRecurrencePattern(recurrencePattern);
        return this;
    }

    /**
     * Get the timeZoneId property: The IANA timezone id for the schedule.
     *
     * @return the timeZoneId value.
     */
    public String timeZoneId() {
        return this.innerProperties() == null ? null : this.innerProperties().timeZoneId();
    }

    /**
     * Set the timeZoneId property: The IANA timezone id for the schedule.
     *
     * @param timeZoneId the timeZoneId value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withTimeZoneId(String timeZoneId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withTimeZoneId(timeZoneId);
        return this;
    }

    /**
     * Get the notes property: Notes for this schedule.
     *
     * @return the notes value.
     */
    public String notes() {
        return this.innerProperties() == null ? null : this.innerProperties().notes();
    }

    /**
     * Set the notes property: Notes for this schedule.
     *
     * @param notes the notes value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withNotes(String notes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withNotes(notes);
        return this;
    }

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

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