// 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.SourceControlSyncJobCreateProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameters supplied to the create source control sync job operation. */
@Fluent
public final class SourceControlSyncJobCreateParameters {
    /*
     * The properties of the source control sync job.
     */
    @JsonProperty(value = "properties", required = true)
    private SourceControlSyncJobCreateProperties innerProperties = new SourceControlSyncJobCreateProperties();

    /**
     * Get the innerProperties property: The properties of the source control sync job.
     *
     * @return the innerProperties value.
     */
    private SourceControlSyncJobCreateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the commitId property: The commit id of the source control sync job. If not syncing to a commitId, enter an
     * empty string.
     *
     * @return the commitId value.
     */
    public String commitId() {
        return this.innerProperties() == null ? null : this.innerProperties().commitId();
    }

    /**
     * Set the commitId property: The commit id of the source control sync job. If not syncing to a commitId, enter an
     * empty string.
     *
     * @param commitId the commitId value to set.
     * @return the SourceControlSyncJobCreateParameters object itself.
     */
    public SourceControlSyncJobCreateParameters withCommitId(String commitId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlSyncJobCreateProperties();
        }
        this.innerProperties().withCommitId(commitId);
        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 SourceControlSyncJobCreateParameters"));
        } else {
            innerProperties().validate();
        }
    }

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