// 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.List;
import java.util.Map;

/** The API resource properties. */
@Fluent
public class ApiResourceProperties {
    /*
     * The name
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * The connection parameters.
     */
    @JsonProperty(value = "connectionParameters", access = JsonProperty.Access.WRITE_ONLY)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> connectionParameters;

    /*
     * The metadata.
     */
    @JsonProperty(value = "metadata", access = JsonProperty.Access.WRITE_ONLY)
    private ApiResourceMetadata metadata;

    /*
     * The runtime urls.
     */
    @JsonProperty(value = "runtimeUrls", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> runtimeUrls;

    /*
     * The api general information.
     */
    @JsonProperty(value = "generalInformation", access = JsonProperty.Access.WRITE_ONLY)
    private ApiResourceGeneralInformation generalInformation;

    /*
     * The capabilities.
     */
    @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> capabilities;

    /*
     * The backend service.
     */
    @JsonProperty(value = "backendService", access = JsonProperty.Access.WRITE_ONLY)
    private ApiResourceBackendService backendService;

    /*
     * The policies for the API.
     */
    @JsonProperty(value = "policies", access = JsonProperty.Access.WRITE_ONLY)
    private ApiResourcePolicies policies;

    /*
     * The API definition.
     */
    @JsonProperty(value = "apiDefinitionUrl", access = JsonProperty.Access.WRITE_ONLY)
    private String apiDefinitionUrl;

    /*
     * The api definitions.
     */
    @JsonProperty(value = "apiDefinitions", access = JsonProperty.Access.WRITE_ONLY)
    private ApiResourceDefinitions apiDefinitions;

    /*
     * The integration service environment reference.
     */
    @JsonProperty(value = "integrationServiceEnvironment")
    private ResourceReference integrationServiceEnvironment;

    /*
     * The provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private WorkflowProvisioningState provisioningState;

    /*
     * The category.
     */
    @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY)
    private ApiTier category;

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

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

    /**
     * Get the connectionParameters property: The connection parameters.
     *
     * @return the connectionParameters value.
     */
    public Map<String, Object> connectionParameters() {
        return this.connectionParameters;
    }

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

    /**
     * Get the runtimeUrls property: The runtime urls.
     *
     * @return the runtimeUrls value.
     */
    public List<String> runtimeUrls() {
        return this.runtimeUrls;
    }

    /**
     * Get the generalInformation property: The api general information.
     *
     * @return the generalInformation value.
     */
    public ApiResourceGeneralInformation generalInformation() {
        return this.generalInformation;
    }

    /**
     * Get the capabilities property: The capabilities.
     *
     * @return the capabilities value.
     */
    public List<String> capabilities() {
        return this.capabilities;
    }

    /**
     * Get the backendService property: The backend service.
     *
     * @return the backendService value.
     */
    public ApiResourceBackendService backendService() {
        return this.backendService;
    }

    /**
     * Get the policies property: The policies for the API.
     *
     * @return the policies value.
     */
    public ApiResourcePolicies policies() {
        return this.policies;
    }

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

    /**
     * Get the apiDefinitions property: The api definitions.
     *
     * @return the apiDefinitions value.
     */
    public ApiResourceDefinitions apiDefinitions() {
        return this.apiDefinitions;
    }

    /**
     * Get the integrationServiceEnvironment property: The integration service environment reference.
     *
     * @return the integrationServiceEnvironment value.
     */
    public ResourceReference integrationServiceEnvironment() {
        return this.integrationServiceEnvironment;
    }

    /**
     * Set the integrationServiceEnvironment property: The integration service environment reference.
     *
     * @param integrationServiceEnvironment the integrationServiceEnvironment value to set.
     * @return the ApiResourceProperties object itself.
     */
    public ApiResourceProperties withIntegrationServiceEnvironment(ResourceReference integrationServiceEnvironment) {
        this.integrationServiceEnvironment = integrationServiceEnvironment;
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state.
     *
     * @return the provisioningState value.
     */
    public WorkflowProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (metadata() != null) {
            metadata().validate();
        }
        if (generalInformation() != null) {
            generalInformation().validate();
        }
        if (backendService() != null) {
            backendService().validate();
        }
        if (policies() != null) {
            policies().validate();
        }
        if (apiDefinitions() != null) {
            apiDefinitions().validate();
        }
        if (integrationServiceEnvironment() != null) {
            integrationServiceEnvironment().validate();
        }
    }
}
