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

package com.azure.resourcemanager.logic.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The api operations properties. */
@Fluent
public final class ApiOperationPropertiesDefinition {
    /*
     * The summary of the api operation.
     */
    @JsonProperty(value = "summary")
    private String summary;

    /*
     * The description of the api operation.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The visibility of the api operation.
     */
    @JsonProperty(value = "visibility")
    private String visibility;

    /*
     * The trigger type of api operation.
     */
    @JsonProperty(value = "trigger")
    private String trigger;

    /*
     * The trigger hint for the api operation.
     */
    @JsonProperty(value = "triggerHint")
    private String triggerHint;

    /*
     * Indicates whether the api operation is pageable.
     */
    @JsonProperty(value = "pageable")
    private Boolean pageable;

    /*
     * The annotation of api operation.
     */
    @JsonProperty(value = "annotation")
    private ApiOperationAnnotation annotation;

    /*
     * The api reference.
     */
    @JsonProperty(value = "api")
    private ApiReference api;

    /*
     * The operation inputs definition schema.
     */
    @JsonProperty(value = "inputsDefinition")
    private SwaggerSchema inputsDefinition;

    /*
     * The operation responses definition schemas.
     */
    @JsonProperty(value = "responsesDefinition")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, SwaggerSchema> responsesDefinition;

    /*
     * Indicates whether the API operation is webhook or not.
     */
    @JsonProperty(value = "isWebhook")
    private Boolean isWebhook;

    /*
     * Indicates whether the API operation is notification or not.
     */
    @JsonProperty(value = "isNotification")
    private Boolean isNotification;

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

    /**
     * Get the summary property: The summary of the api operation.
     *
     * @return the summary value.
     */
    public String summary() {
        return this.summary;
    }

    /**
     * Set the summary property: The summary of the api operation.
     *
     * @param summary the summary value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withSummary(String summary) {
        this.summary = summary;
        return this;
    }

    /**
     * Get the description property: The description of the api operation.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The description of the api operation.
     *
     * @param description the description value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the visibility property: The visibility of the api operation.
     *
     * @return the visibility value.
     */
    public String visibility() {
        return this.visibility;
    }

    /**
     * Set the visibility property: The visibility of the api operation.
     *
     * @param visibility the visibility value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withVisibility(String visibility) {
        this.visibility = visibility;
        return this;
    }

    /**
     * Get the trigger property: The trigger type of api operation.
     *
     * @return the trigger value.
     */
    public String trigger() {
        return this.trigger;
    }

    /**
     * Set the trigger property: The trigger type of api operation.
     *
     * @param trigger the trigger value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withTrigger(String trigger) {
        this.trigger = trigger;
        return this;
    }

    /**
     * Get the triggerHint property: The trigger hint for the api operation.
     *
     * @return the triggerHint value.
     */
    public String triggerHint() {
        return this.triggerHint;
    }

    /**
     * Set the triggerHint property: The trigger hint for the api operation.
     *
     * @param triggerHint the triggerHint value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withTriggerHint(String triggerHint) {
        this.triggerHint = triggerHint;
        return this;
    }

    /**
     * Get the pageable property: Indicates whether the api operation is pageable.
     *
     * @return the pageable value.
     */
    public Boolean pageable() {
        return this.pageable;
    }

    /**
     * Set the pageable property: Indicates whether the api operation is pageable.
     *
     * @param pageable the pageable value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withPageable(Boolean pageable) {
        this.pageable = pageable;
        return this;
    }

    /**
     * Get the annotation property: The annotation of api operation.
     *
     * @return the annotation value.
     */
    public ApiOperationAnnotation annotation() {
        return this.annotation;
    }

    /**
     * Set the annotation property: The annotation of api operation.
     *
     * @param annotation the annotation value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withAnnotation(ApiOperationAnnotation annotation) {
        this.annotation = annotation;
        return this;
    }

    /**
     * Get the api property: The api reference.
     *
     * @return the api value.
     */
    public ApiReference api() {
        return this.api;
    }

    /**
     * Set the api property: The api reference.
     *
     * @param api the api value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withApi(ApiReference api) {
        this.api = api;
        return this;
    }

    /**
     * Get the inputsDefinition property: The operation inputs definition schema.
     *
     * @return the inputsDefinition value.
     */
    public SwaggerSchema inputsDefinition() {
        return this.inputsDefinition;
    }

    /**
     * Set the inputsDefinition property: The operation inputs definition schema.
     *
     * @param inputsDefinition the inputsDefinition value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withInputsDefinition(SwaggerSchema inputsDefinition) {
        this.inputsDefinition = inputsDefinition;
        return this;
    }

    /**
     * Get the responsesDefinition property: The operation responses definition schemas.
     *
     * @return the responsesDefinition value.
     */
    public Map<String, SwaggerSchema> responsesDefinition() {
        return this.responsesDefinition;
    }

    /**
     * Set the responsesDefinition property: The operation responses definition schemas.
     *
     * @param responsesDefinition the responsesDefinition value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withResponsesDefinition(Map<String, SwaggerSchema> responsesDefinition) {
        this.responsesDefinition = responsesDefinition;
        return this;
    }

    /**
     * Get the isWebhook property: Indicates whether the API operation is webhook or not.
     *
     * @return the isWebhook value.
     */
    public Boolean isWebhook() {
        return this.isWebhook;
    }

    /**
     * Set the isWebhook property: Indicates whether the API operation is webhook or not.
     *
     * @param isWebhook the isWebhook value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withIsWebhook(Boolean isWebhook) {
        this.isWebhook = isWebhook;
        return this;
    }

    /**
     * Get the isNotification property: Indicates whether the API operation is notification or not.
     *
     * @return the isNotification value.
     */
    public Boolean isNotification() {
        return this.isNotification;
    }

    /**
     * Set the isNotification property: Indicates whether the API operation is notification or not.
     *
     * @param isNotification the isNotification value to set.
     * @return the ApiOperationPropertiesDefinition object itself.
     */
    public ApiOperationPropertiesDefinition withIsNotification(Boolean isNotification) {
        this.isNotification = isNotification;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (annotation() != null) {
            annotation().validate();
        }
        if (api() != null) {
            api().validate();
        }
        if (inputsDefinition() != null) {
            inputsDefinition().validate();
        }
        if (responsesDefinition() != null) {
            responsesDefinition()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
    }
}
