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

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Compute start stop schedule properties. */
@Fluent
public final class ComputeStartStopSchedule {
    /*
     * A system assigned id for the schedule.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * The current deployment state of schedule.
     */
    @JsonProperty(value = "provisioningStatus", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningStatus provisioningStatus;

    /*
     * Is the schedule enabled or disabled?
     */
    @JsonProperty(value = "status")
    private ScheduleStatus status;

    /*
     * [Required] The compute power action.
     */
    @JsonProperty(value = "action")
    private ComputePowerAction action;

    /*
     * [Required] The schedule trigger type.
     */
    @JsonProperty(value = "triggerType")
    private TriggerType triggerType;

    /*
     * Required if triggerType is Recurrence.
     */
    @JsonProperty(value = "recurrence")
    private RecurrenceTrigger recurrence;

    /*
     * Required if triggerType is Cron.
     */
    @JsonProperty(value = "cron")
    private CronTrigger cron;

    /*
     * [Deprecated] Not used any more.
     */
    @JsonProperty(value = "schedule")
    private ScheduleBase schedule;

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

    /**
     * Get the id property: A system assigned id for the schedule.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the provisioningStatus property: The current deployment state of schedule.
     *
     * @return the provisioningStatus value.
     */
    public ProvisioningStatus provisioningStatus() {
        return this.provisioningStatus;
    }

    /**
     * Get the status property: Is the schedule enabled or disabled?.
     *
     * @return the status value.
     */
    public ScheduleStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Is the schedule enabled or disabled?.
     *
     * @param status the status value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withStatus(ScheduleStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the action property: [Required] The compute power action.
     *
     * @return the action value.
     */
    public ComputePowerAction action() {
        return this.action;
    }

    /**
     * Set the action property: [Required] The compute power action.
     *
     * @param action the action value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withAction(ComputePowerAction action) {
        this.action = action;
        return this;
    }

    /**
     * Get the triggerType property: [Required] The schedule trigger type.
     *
     * @return the triggerType value.
     */
    public TriggerType triggerType() {
        return this.triggerType;
    }

    /**
     * Set the triggerType property: [Required] The schedule trigger type.
     *
     * @param triggerType the triggerType value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withTriggerType(TriggerType triggerType) {
        this.triggerType = triggerType;
        return this;
    }

    /**
     * Get the recurrence property: Required if triggerType is Recurrence.
     *
     * @return the recurrence value.
     */
    public RecurrenceTrigger recurrence() {
        return this.recurrence;
    }

    /**
     * Set the recurrence property: Required if triggerType is Recurrence.
     *
     * @param recurrence the recurrence value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withRecurrence(RecurrenceTrigger recurrence) {
        this.recurrence = recurrence;
        return this;
    }

    /**
     * Get the cron property: Required if triggerType is Cron.
     *
     * @return the cron value.
     */
    public CronTrigger cron() {
        return this.cron;
    }

    /**
     * Set the cron property: Required if triggerType is Cron.
     *
     * @param cron the cron value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withCron(CronTrigger cron) {
        this.cron = cron;
        return this;
    }

    /**
     * Get the schedule property: [Deprecated] Not used any more.
     *
     * @return the schedule value.
     */
    public ScheduleBase schedule() {
        return this.schedule;
    }

    /**
     * Set the schedule property: [Deprecated] Not used any more.
     *
     * @param schedule the schedule value to set.
     * @return the ComputeStartStopSchedule object itself.
     */
    public ComputeStartStopSchedule withSchedule(ScheduleBase schedule) {
        this.schedule = schedule;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (recurrence() != null) {
            recurrence().validate();
        }
        if (cron() != null) {
            cron().validate();
        }
        if (schedule() != null) {
            schedule().validate();
        }
    }
}
