// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId;
import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** TI (Threat Intelligence) data connector properties. */
@Fluent
public final class TIDataConnectorProperties extends DataConnectorTenantId {
    /*
     * The lookback period for the feed to be imported.
     */
    @JsonProperty(value = "tipLookbackPeriod")
    private OffsetDateTime tipLookbackPeriod;

    /*
     * The available data types for the connector.
     */
    @JsonProperty(value = "dataTypes", required = true)
    private TIDataConnectorDataTypes dataTypes;

    /**
     * Get the tipLookbackPeriod property: The lookback period for the feed to be imported.
     *
     * @return the tipLookbackPeriod value.
     */
    public OffsetDateTime tipLookbackPeriod() {
        return this.tipLookbackPeriod;
    }

    /**
     * Set the tipLookbackPeriod property: The lookback period for the feed to be imported.
     *
     * @param tipLookbackPeriod the tipLookbackPeriod value to set.
     * @return the TIDataConnectorProperties object itself.
     */
    public TIDataConnectorProperties withTipLookbackPeriod(OffsetDateTime tipLookbackPeriod) {
        this.tipLookbackPeriod = tipLookbackPeriod;
        return this;
    }

    /**
     * Get the dataTypes property: The available data types for the connector.
     *
     * @return the dataTypes value.
     */
    public TIDataConnectorDataTypes dataTypes() {
        return this.dataTypes;
    }

    /**
     * Set the dataTypes property: The available data types for the connector.
     *
     * @param dataTypes the dataTypes value to set.
     * @return the TIDataConnectorProperties object itself.
     */
    public TIDataConnectorProperties withDataTypes(TIDataConnectorDataTypes dataTypes) {
        this.dataTypes = dataTypes;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TIDataConnectorProperties withTenantId(String tenantId) {
        super.withTenantId(tenantId);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (dataTypes() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property dataTypes in model TIDataConnectorProperties"));
        } else {
            dataTypes().validate();
        }
    }

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