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

/** Definition of hybrid runbook worker group property. */
@Fluent
public final class HybridRunbookWorkerGroupProperties {
    /*
     * Type of the HybridWorkerGroup.
     */
    @JsonProperty(value = "groupType")
    private GroupTypeEnum groupType;

    /*
     * Sets the credential of a worker group.
     */
    @JsonProperty(value = "credential")
    private RunAsCredentialAssociationProperty credential;

    /**
     * Get the groupType property: Type of the HybridWorkerGroup.
     *
     * @return the groupType value.
     */
    public GroupTypeEnum groupType() {
        return this.groupType;
    }

    /**
     * Set the groupType property: Type of the HybridWorkerGroup.
     *
     * @param groupType the groupType value to set.
     * @return the HybridRunbookWorkerGroupProperties object itself.
     */
    public HybridRunbookWorkerGroupProperties withGroupType(GroupTypeEnum groupType) {
        this.groupType = groupType;
        return this;
    }

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

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

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