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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.models.DayDetails;
import com.azure.resourcemanager.devtestlabs.models.EnableStatus;
import com.azure.resourcemanager.devtestlabs.models.HourDetails;
import com.azure.resourcemanager.devtestlabs.models.NotificationSettings;
import com.azure.resourcemanager.devtestlabs.models.WeekDetails;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** A schedule. */
@Fluent
public final class ScheduleInner extends Resource {
    /*
     * The properties of the resource.
     */
    @JsonProperty(value = "properties", required = true)
    private ScheduleProperties innerProperties = new ScheduleProperties();

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

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

    /** {@inheritDoc} */
    @Override
    public ScheduleInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ScheduleInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the status property: The status of the schedule (i.e. Enabled, Disabled).
     *
     * @return the status value.
     */
    public EnableStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: The status of the schedule (i.e. Enabled, Disabled).
     *
     * @param status the status value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withStatus(EnableStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).
     *
     * @return the taskType value.
     */
    public String taskType() {
        return this.innerProperties() == null ? null : this.innerProperties().taskType();
    }

    /**
     * Set the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).
     *
     * @param taskType the taskType value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withTaskType(String taskType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withTaskType(taskType);
        return this;
    }

    /**
     * Get the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly
     * recurrence.
     *
     * @return the weeklyRecurrence value.
     */
    public WeekDetails weeklyRecurrence() {
        return this.innerProperties() == null ? null : this.innerProperties().weeklyRecurrence();
    }

    /**
     * Set the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly
     * recurrence.
     *
     * @param weeklyRecurrence the weeklyRecurrence value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withWeeklyRecurrence(WeekDetails weeklyRecurrence) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withWeeklyRecurrence(weeklyRecurrence);
        return this;
    }

    /**
     * Get the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily
     * recurrence.
     *
     * @return the dailyRecurrence value.
     */
    public DayDetails dailyRecurrence() {
        return this.innerProperties() == null ? null : this.innerProperties().dailyRecurrence();
    }

    /**
     * Set the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily
     * recurrence.
     *
     * @param dailyRecurrence the dailyRecurrence value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withDailyRecurrence(DayDetails dailyRecurrence) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withDailyRecurrence(dailyRecurrence);
        return this;
    }

    /**
     * Get the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly
     * recurrence.
     *
     * @return the hourlyRecurrence value.
     */
    public HourDetails hourlyRecurrence() {
        return this.innerProperties() == null ? null : this.innerProperties().hourlyRecurrence();
    }

    /**
     * Set the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly
     * recurrence.
     *
     * @param hourlyRecurrence the hourlyRecurrence value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withHourlyRecurrence(HourDetails hourlyRecurrence) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withHourlyRecurrence(hourlyRecurrence);
        return this;
    }

    /**
     * Get the timeZoneId property: The time zone ID (e.g. Pacific Standard time).
     *
     * @return the timeZoneId value.
     */
    public String timeZoneId() {
        return this.innerProperties() == null ? null : this.innerProperties().timeZoneId();
    }

    /**
     * Set the timeZoneId property: The time zone ID (e.g. Pacific Standard time).
     *
     * @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 notificationSettings property: Notification settings.
     *
     * @return the notificationSettings value.
     */
    public NotificationSettings notificationSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().notificationSettings();
    }

    /**
     * Set the notificationSettings property: Notification settings.
     *
     * @param notificationSettings the notificationSettings value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withNotificationSettings(NotificationSettings notificationSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withNotificationSettings(notificationSettings);
        return this;
    }

    /**
     * Get the createdDate property: The creation date of the schedule.
     *
     * @return the createdDate value.
     */
    public OffsetDateTime createdDate() {
        return this.innerProperties() == null ? null : this.innerProperties().createdDate();
    }

    /**
     * Get the targetResourceId property: The resource ID to which the schedule belongs.
     *
     * @return the targetResourceId value.
     */
    public String targetResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().targetResourceId();
    }

    /**
     * Set the targetResourceId property: The resource ID to which the schedule belongs.
     *
     * @param targetResourceId the targetResourceId value to set.
     * @return the ScheduleInner object itself.
     */
    public ScheduleInner withTargetResourceId(String targetResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScheduleProperties();
        }
        this.innerProperties().withTargetResourceId(targetResourceId);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning status of the resource.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid).
     *
     * @return the uniqueIdentifier value.
     */
    public String uniqueIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueIdentifier();
    }

    /**
     * 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);
}
