// 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Definition of job schedule parameters. */
@Fluent
public final class JobScheduleProperties {
    /*
     * Gets or sets the id of job schedule.
     */
    @JsonProperty(value = "jobScheduleId")
    private String jobScheduleId;

    /*
     * Gets or sets the schedule.
     */
    @JsonProperty(value = "schedule")
    private ScheduleAssociationProperty schedule;

    /*
     * Gets or sets the runbook.
     */
    @JsonProperty(value = "runbook")
    private RunbookAssociationProperty runbook;

    /*
     * Gets or sets the hybrid worker group that the scheduled job should run on.
     */
    @JsonProperty(value = "runOn")
    private String runOn;

    /*
     * Gets or sets the parameters of the job schedule.
     */
    @JsonProperty(value = "parameters")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> parameters;

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

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

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

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

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

    /**
     * Set the runbook property: Gets or sets the runbook.
     *
     * @param runbook the runbook value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withRunbook(RunbookAssociationProperty runbook) {
        this.runbook = 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.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 JobScheduleProperties object itself.
     */
    public JobScheduleProperties withRunOn(String runOn) {
        this.runOn = 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.parameters;
    }

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

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