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

package com.azure.resourcemanager.securityinsights.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.securityinsights.fluent.models.ApiPollingParameters;
import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Represents Codeless API Polling data connector. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("APIPolling")
@Fluent
public final class CodelessApiPollingDataConnector extends DataConnectorInner {
    /*
     * Codeless poling data connector properties
     */
    @JsonProperty(value = "properties")
    private ApiPollingParameters innerProperties;

    /**
     * Get the innerProperties property: Codeless poling data connector properties.
     *
     * @return the innerProperties value.
     */
    private ApiPollingParameters innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public CodelessApiPollingDataConnector withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the connectorUiConfig property: Config to describe the instructions blade.
     *
     * @return the connectorUiConfig value.
     */
    public CodelessUiConnectorConfigProperties connectorUiConfig() {
        return this.innerProperties() == null ? null : this.innerProperties().connectorUiConfig();
    }

    /**
     * Set the connectorUiConfig property: Config to describe the instructions blade.
     *
     * @param connectorUiConfig the connectorUiConfig value to set.
     * @return the CodelessApiPollingDataConnector object itself.
     */
    public CodelessApiPollingDataConnector withConnectorUiConfig(
        CodelessUiConnectorConfigProperties connectorUiConfig) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApiPollingParameters();
        }
        this.innerProperties().withConnectorUiConfig(connectorUiConfig);
        return this;
    }

    /**
     * Get the pollingConfig property: Config to describe the polling instructions.
     *
     * @return the pollingConfig value.
     */
    public CodelessConnectorPollingConfigProperties pollingConfig() {
        return this.innerProperties() == null ? null : this.innerProperties().pollingConfig();
    }

    /**
     * Set the pollingConfig property: Config to describe the polling instructions.
     *
     * @param pollingConfig the pollingConfig value to set.
     * @return the CodelessApiPollingDataConnector object itself.
     */
    public CodelessApiPollingDataConnector withPollingConfig(CodelessConnectorPollingConfigProperties pollingConfig) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApiPollingParameters();
        }
        this.innerProperties().withPollingConfig(pollingConfig);
        return this;
    }

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