// 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.DataConnectorInner;
import com.azure.resourcemanager.securityinsights.fluent.models.TiTaxiiDataConnectorProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;

/** Data connector to pull Threat intelligence data from TAXII 2.0/2.1 server. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("ThreatIntelligenceTaxii")
@Fluent
public final class TiTaxiiDataConnector extends DataConnectorInner {
    /*
     * Threat intelligence TAXII data connector properties.
     */
    @JsonProperty(value = "properties")
    private TiTaxiiDataConnectorProperties innerProperties;

    /**
     * Get the innerProperties property: Threat intelligence TAXII data connector properties.
     *
     * @return the innerProperties value.
     */
    private TiTaxiiDataConnectorProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Get the workspaceId property: The workspace id.
     *
     * @return the workspaceId value.
     */
    public String workspaceId() {
        return this.innerProperties() == null ? null : this.innerProperties().workspaceId();
    }

    /**
     * Set the workspaceId property: The workspace id.
     *
     * @param workspaceId the workspaceId value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withWorkspaceId(String workspaceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withWorkspaceId(workspaceId);
        return this;
    }

    /**
     * Get the friendlyName property: The friendly name for the TAXII server.
     *
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.innerProperties() == null ? null : this.innerProperties().friendlyName();
    }

    /**
     * Set the friendlyName property: The friendly name for the TAXII server.
     *
     * @param friendlyName the friendlyName value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withFriendlyName(String friendlyName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withFriendlyName(friendlyName);
        return this;
    }

    /**
     * Get the taxiiServer property: The API root for the TAXII server.
     *
     * @return the taxiiServer value.
     */
    public String taxiiServer() {
        return this.innerProperties() == null ? null : this.innerProperties().taxiiServer();
    }

    /**
     * Set the taxiiServer property: The API root for the TAXII server.
     *
     * @param taxiiServer the taxiiServer value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withTaxiiServer(String taxiiServer) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withTaxiiServer(taxiiServer);
        return this;
    }

    /**
     * Get the collectionId property: The collection id of the TAXII server.
     *
     * @return the collectionId value.
     */
    public String collectionId() {
        return this.innerProperties() == null ? null : this.innerProperties().collectionId();
    }

    /**
     * Set the collectionId property: The collection id of the TAXII server.
     *
     * @param collectionId the collectionId value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withCollectionId(String collectionId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withCollectionId(collectionId);
        return this;
    }

    /**
     * Get the username property: The userName for the TAXII server.
     *
     * @return the username value.
     */
    public String username() {
        return this.innerProperties() == null ? null : this.innerProperties().username();
    }

    /**
     * Set the username property: The userName for the TAXII server.
     *
     * @param username the username value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withUsername(String username) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withUsername(username);
        return this;
    }

    /**
     * Get the password property: The password for the TAXII server.
     *
     * @return the password value.
     */
    public String password() {
        return this.innerProperties() == null ? null : this.innerProperties().password();
    }

    /**
     * Set the password property: The password for the TAXII server.
     *
     * @param password the password value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withPassword(String password) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withPassword(password);
        return this;
    }

    /**
     * Get the taxiiLookbackPeriod property: The lookback period for the TAXII server.
     *
     * @return the taxiiLookbackPeriod value.
     */
    public OffsetDateTime taxiiLookbackPeriod() {
        return this.innerProperties() == null ? null : this.innerProperties().taxiiLookbackPeriod();
    }

    /**
     * Set the taxiiLookbackPeriod property: The lookback period for the TAXII server.
     *
     * @param taxiiLookbackPeriod the taxiiLookbackPeriod value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withTaxiiLookbackPeriod(OffsetDateTime taxiiLookbackPeriod) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withTaxiiLookbackPeriod(taxiiLookbackPeriod);
        return this;
    }

    /**
     * Get the pollingFrequency property: The polling frequency for the TAXII server.
     *
     * @return the pollingFrequency value.
     */
    public PollingFrequency pollingFrequency() {
        return this.innerProperties() == null ? null : this.innerProperties().pollingFrequency();
    }

    /**
     * Set the pollingFrequency property: The polling frequency for the TAXII server.
     *
     * @param pollingFrequency the pollingFrequency value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withPollingFrequency(PollingFrequency pollingFrequency) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withPollingFrequency(pollingFrequency);
        return this;
    }

    /**
     * Get the dataTypes property: The available data types for Threat Intelligence TAXII data connector.
     *
     * @return the dataTypes value.
     */
    public TiTaxiiDataConnectorDataTypes dataTypes() {
        return this.innerProperties() == null ? null : this.innerProperties().dataTypes();
    }

    /**
     * Set the dataTypes property: The available data types for Threat Intelligence TAXII data connector.
     *
     * @param dataTypes the dataTypes value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withDataTypes(TiTaxiiDataConnectorDataTypes dataTypes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withDataTypes(dataTypes);
        return this;
    }

    /**
     * Get the tenantId property: The tenant id to connect to, and get the data from.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().tenantId();
    }

    /**
     * Set the tenantId property: The tenant id to connect to, and get the data from.
     *
     * @param tenantId the tenantId value to set.
     * @return the TiTaxiiDataConnector object itself.
     */
    public TiTaxiiDataConnector withTenantId(String tenantId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TiTaxiiDataConnectorProperties();
        }
        this.innerProperties().withTenantId(tenantId);
        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();
        }
    }
}
