// 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.resourcemanager.automation.fluent.models.HybridRunbookWorkerGroupCreateOrUpdateProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameters supplied to the create hybrid runbook worker group operation. */
@Fluent
public final class HybridRunbookWorkerGroupCreateOrUpdateParameters {
    /*
     * Gets or sets hybrid runbook worker group create or update properties.
     */
    @JsonProperty(value = "properties")
    private HybridRunbookWorkerGroupCreateOrUpdateProperties innerProperties;

    /*
     * Gets or sets the name of the resource.
     */
    @JsonProperty(value = "name")
    private String name;

    /**
     * Get the innerProperties property: Gets or sets hybrid runbook worker group create or update properties.
     *
     * @return the innerProperties value.
     */
    private HybridRunbookWorkerGroupCreateOrUpdateProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Set the name property: Gets or sets the name of the resource.
     *
     * @param name the name value to set.
     * @return the HybridRunbookWorkerGroupCreateOrUpdateParameters object itself.
     */
    public HybridRunbookWorkerGroupCreateOrUpdateParameters withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the credential property: Sets the credential of a worker group.
     *
     * @return the credential value.
     */
    public RunAsCredentialAssociationProperty credential() {
        return this.innerProperties() == null ? null : this.innerProperties().credential();
    }

    /**
     * Set the credential property: Sets the credential of a worker group.
     *
     * @param credential the credential value to set.
     * @return the HybridRunbookWorkerGroupCreateOrUpdateParameters object itself.
     */
    public HybridRunbookWorkerGroupCreateOrUpdateParameters withCredential(
        RunAsCredentialAssociationProperty credential) {
        if (this.innerProperties() == null) {
            this.innerProperties = new HybridRunbookWorkerGroupCreateOrUpdateProperties();
        }
        this.innerProperties().withCredential(credential);
        return this;
    }

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