// 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.core.management.ProxyResource;
import com.azure.core.management.SystemData;
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. */
@Fluent
public final class HybridRunbookWorkerGroupInner extends ProxyResource {
    /*
     * Gets or sets the hybrid worker group properties.
     */
    @JsonProperty(value = "properties")
    private HybridRunbookWorkerGroupProperties innerProperties;

    /*
     * Resource system metadata.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the systemData property: Resource system metadata.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

    /**
     * Set the groupType property: Type of the HybridWorkerGroup.
     *
     * @param groupType the groupType value to set.
     * @return the HybridRunbookWorkerGroupInner object itself.
     */
    public HybridRunbookWorkerGroupInner withGroupType(GroupTypeEnum groupType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new HybridRunbookWorkerGroupProperties();
        }
        this.innerProperties().withGroupType(groupType);
        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 HybridRunbookWorkerGroupInner object itself.
     */
    public HybridRunbookWorkerGroupInner withCredential(RunAsCredentialAssociationProperty credential) {
        if (this.innerProperties() == null) {
            this.innerProperties = new HybridRunbookWorkerGroupProperties();
        }
        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();
        }
    }
}
