// 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.automation.fluent.models.JobScheduleCreateProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The parameters supplied to the create job schedule operation. */
@Fluent
public final class JobScheduleCreateParameters {
    /*
     * Gets or sets the list of job schedule properties.
     */
    @JsonProperty(value = "properties", required = true)
    private JobScheduleCreateProperties innerProperties = new JobScheduleCreateProperties();

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

    /**
     * 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 JobScheduleCreateParameters object itself.
     */
    public JobScheduleCreateParameters withSchedule(ScheduleAssociationProperty schedule) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleCreateProperties();
        }
        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 JobScheduleCreateParameters object itself.
     */
    public JobScheduleCreateParameters withRunbook(RunbookAssociationProperty runbook) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleCreateProperties();
        }
        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 JobScheduleCreateParameters object itself.
     */
    public JobScheduleCreateParameters withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleCreateProperties();
        }
        this.innerProperties().withRunOn(runOn);
        return this;
    }

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

    /**
     * Set the parameters property: Gets or sets a list of job properties.
     *
     * @param parameters the parameters value to set.
     * @return the JobScheduleCreateParameters object itself.
     */
    public JobScheduleCreateParameters withParameters(Map<String, String> parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleCreateProperties();
        }
        this.innerProperties().withParameters(parameters);
        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 JobScheduleCreateParameters"));
        } else {
            innerProperties().validate();
        }
    }

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