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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.automation.models.RunbookAssociationProperty;
import com.azure.resourcemanager.automation.models.ScheduleAssociationProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Definition of the job schedule. */
@Fluent
public final class JobScheduleInner {
    /*
     * Gets the id of the resource.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Gets the name of the variable.
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * Resource type
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /*
     * Gets or sets the properties of the job schedule.
     */
    @JsonProperty(value = "properties")
    private JobScheduleProperties innerProperties;

    /**
     * Get the id property: Gets the id of the resource.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: Gets the name of the variable.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: Resource type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the innerProperties property: Gets or sets the properties of the job schedule.
     *
     * @return the innerProperties value.
     */
    private JobScheduleProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the jobScheduleId property: Gets or sets the id of job schedule.
     *
     * @return the jobScheduleId value.
     */
    public String jobScheduleId() {
        return this.innerProperties() == null ? null : this.innerProperties().jobScheduleId();
    }

    /**
     * Set the jobScheduleId property: Gets or sets the id of job schedule.
     *
     * @param jobScheduleId the jobScheduleId value to set.
     * @return the JobScheduleInner object itself.
     */
    public JobScheduleInner withJobScheduleId(String jobScheduleId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withJobScheduleId(jobScheduleId);
        return this;
    }

    /**
     * Get the schedule property: Gets or sets the schedule.
     *
     * @return the schedule value.
     */
    public ScheduleAssociationProperty schedule() {
        return this.innerProperties() == null ? null : this.innerProperties().schedule();
    }

    /**
     * Set the schedule property: Gets or sets the schedule.
     *
     * @param schedule the schedule value to set.
     * @return the JobScheduleInner object itself.
     */
    public JobScheduleInner withSchedule(ScheduleAssociationProperty schedule) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withSchedule(schedule);
        return this;
    }

    /**
     * Get the runbook property: Gets or sets the runbook.
     *
     * @return the runbook value.
     */
    public RunbookAssociationProperty runbook() {
        return this.innerProperties() == null ? null : this.innerProperties().runbook();
    }

    /**
     * Set the runbook property: Gets or sets the runbook.
     *
     * @param runbook the runbook value to set.
     * @return the JobScheduleInner object itself.
     */
    public JobScheduleInner withRunbook(RunbookAssociationProperty runbook) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withRunbook(runbook);
        return this;
    }

    /**
     * Get the runOn property: Gets or sets the hybrid worker group that the scheduled job should run on.
     *
     * @return the runOn value.
     */
    public String runOn() {
        return this.innerProperties() == null ? null : this.innerProperties().runOn();
    }

    /**
     * Set the runOn property: Gets or sets the hybrid worker group that the scheduled job should run on.
     *
     * @param runOn the runOn value to set.
     * @return the JobScheduleInner object itself.
     */
    public JobScheduleInner withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withRunOn(runOn);
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the parameters of the job schedule.
     *
     * @return the parameters value.
     */
    public Map<String, String> parameters() {
        return this.innerProperties() == null ? null : this.innerProperties().parameters();
    }

    /**
     * Set the parameters property: Gets or sets the parameters of the job schedule.
     *
     * @param parameters the parameters value to set.
     * @return the JobScheduleInner object itself.
     */
    public JobScheduleInner withParameters(Map<String, String> parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

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