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

package com.azure.resourcemanager.alertsmanagement.models;

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

/** Data contract for patch. */
@Fluent
public final class PatchObject {
    /*
     * Properties supported by patch operation.
     */
    @JsonProperty(value = "properties")
    private PatchProperties innerProperties;

    /*
     * Tags to be updated.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /**
     * Get the innerProperties property: Properties supported by patch operation.
     *
     * @return the innerProperties value.
     */
    private PatchProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * Get the enabled property: Indicates if the given alert processing rule is enabled or disabled.
     *
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.innerProperties() == null ? null : this.innerProperties().enabled();
    }

    /**
     * Set the enabled property: Indicates if the given alert processing rule is enabled or disabled.
     *
     * @param enabled the enabled value to set.
     * @return the PatchObject object itself.
     */
    public PatchObject withEnabled(Boolean enabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PatchProperties();
        }
        this.innerProperties().withEnabled(enabled);
        return this;
    }

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