// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.loadtesting.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.loadtesting.fluent.models.LoadTestResourcePatchRequestBodyProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** LoadTest resource patch request body. */
@Fluent
public final class LoadTestResourcePatchRequestBody {
    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The type of identity used for the resource.
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

    /*
     * Load Test resource properties
     */
    @JsonProperty(value = "properties")
    private LoadTestResourcePatchRequestBodyProperties innerProperties;

    /** Creates an instance of LoadTestResourcePatchRequestBody class. */
    public LoadTestResourcePatchRequestBody() {
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the LoadTestResourcePatchRequestBody object itself.
     */
    public LoadTestResourcePatchRequestBody withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the identity property: The type of identity used for the resource.
     *
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The type of identity used for the resource.
     *
     * @param identity the identity value to set.
     * @return the LoadTestResourcePatchRequestBody object itself.
     */
    public LoadTestResourcePatchRequestBody withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: Load Test resource properties.
     *
     * @return the innerProperties value.
     */
    private LoadTestResourcePatchRequestBodyProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the description property: Description of the resource.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Description of the resource.
     *
     * @param description the description value to set.
     * @return the LoadTestResourcePatchRequestBody object itself.
     */
    public LoadTestResourcePatchRequestBody withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LoadTestResourcePatchRequestBodyProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the encryption property: CMK Encryption property.
     *
     * @return the encryption value.
     */
    public EncryptionProperties encryption() {
        return this.innerProperties() == null ? null : this.innerProperties().encryption();
    }

    /**
     * Set the encryption property: CMK Encryption property.
     *
     * @param encryption the encryption value to set.
     * @return the LoadTestResourcePatchRequestBody object itself.
     */
    public LoadTestResourcePatchRequestBody withEncryption(EncryptionProperties encryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LoadTestResourcePatchRequestBodyProperties();
        }
        this.innerProperties().withEncryption(encryption);
        return this;
    }

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