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

package com.azure.resourcemanager.providerhub.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The LoggingRule model. */
@Fluent
public final class LoggingRule {
    /*
     * The action property.
     */
    @JsonProperty(value = "action", required = true)
    private String action;

    /*
     * The direction property.
     */
    @JsonProperty(value = "direction", required = true)
    private LoggingDirections direction;

    /*
     * The detailLevel property.
     */
    @JsonProperty(value = "detailLevel", required = true)
    private LoggingDetails detailLevel;

    /*
     * The hiddenPropertyPaths property.
     */
    @JsonProperty(value = "hiddenPropertyPaths")
    private LoggingRuleHiddenPropertyPaths hiddenPropertyPaths;

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

    /**
     * Get the action property: The action property.
     *
     * @return the action value.
     */
    public String action() {
        return this.action;
    }

    /**
     * Set the action property: The action property.
     *
     * @param action the action value to set.
     * @return the LoggingRule object itself.
     */
    public LoggingRule withAction(String action) {
        this.action = action;
        return this;
    }

    /**
     * Get the direction property: The direction property.
     *
     * @return the direction value.
     */
    public LoggingDirections direction() {
        return this.direction;
    }

    /**
     * Set the direction property: The direction property.
     *
     * @param direction the direction value to set.
     * @return the LoggingRule object itself.
     */
    public LoggingRule withDirection(LoggingDirections direction) {
        this.direction = direction;
        return this;
    }

    /**
     * Get the detailLevel property: The detailLevel property.
     *
     * @return the detailLevel value.
     */
    public LoggingDetails detailLevel() {
        return this.detailLevel;
    }

    /**
     * Set the detailLevel property: The detailLevel property.
     *
     * @param detailLevel the detailLevel value to set.
     * @return the LoggingRule object itself.
     */
    public LoggingRule withDetailLevel(LoggingDetails detailLevel) {
        this.detailLevel = detailLevel;
        return this;
    }

    /**
     * Get the hiddenPropertyPaths property: The hiddenPropertyPaths property.
     *
     * @return the hiddenPropertyPaths value.
     */
    public LoggingRuleHiddenPropertyPaths hiddenPropertyPaths() {
        return this.hiddenPropertyPaths;
    }

    /**
     * Set the hiddenPropertyPaths property: The hiddenPropertyPaths property.
     *
     * @param hiddenPropertyPaths the hiddenPropertyPaths value to set.
     * @return the LoggingRule object itself.
     */
    public LoggingRule withHiddenPropertyPaths(LoggingRuleHiddenPropertyPaths hiddenPropertyPaths) {
        this.hiddenPropertyPaths = hiddenPropertyPaths;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (action() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property action in model LoggingRule"));
        }
        if (direction() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property direction in model LoggingRule"));
        }
        if (detailLevel() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property detailLevel in model LoggingRule"));
        }
        if (hiddenPropertyPaths() != null) {
            hiddenPropertyPaths().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(LoggingRule.class);
}
