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

package com.azure.resourcemanager.customerinsights.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.customerinsights.models.ConnectorStates;
import com.azure.resourcemanager.customerinsights.models.ConnectorTypes;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Properties of connector. */
@Fluent
public final class Connector {
    /*
     * ID of the connector.
     */
    @JsonProperty(value = "connectorId", access = JsonProperty.Access.WRITE_ONLY)
    private Integer connectorId;

    /*
     * Name of the connector.
     */
    @JsonProperty(value = "connectorName")
    private String connectorName;

    /*
     * Type of connector.
     */
    @JsonProperty(value = "connectorType", required = true)
    private ConnectorTypes connectorType;

    /*
     * Display name of the connector.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * Description of the connector.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The connector properties.
     */
    @JsonProperty(value = "connectorProperties", required = true)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> connectorProperties;

    /*
     * The created time.
     */
    @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime created;

    /*
     * The last modified time.
     */
    @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModified;

    /*
     * State of connector.
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private ConnectorStates state;

    /*
     * The hub name.
     */
    @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
    private String tenantId;

    /*
     * If this is an internal connector.
     */
    @JsonProperty(value = "isInternal")
    private Boolean isInternal;

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

    /**
     * Get the connectorId property: ID of the connector.
     *
     * @return the connectorId value.
     */
    public Integer connectorId() {
        return this.connectorId;
    }

    /**
     * Get the connectorName property: Name of the connector.
     *
     * @return the connectorName value.
     */
    public String connectorName() {
        return this.connectorName;
    }

    /**
     * Set the connectorName property: Name of the connector.
     *
     * @param connectorName the connectorName value to set.
     * @return the Connector object itself.
     */
    public Connector withConnectorName(String connectorName) {
        this.connectorName = connectorName;
        return this;
    }

    /**
     * Get the connectorType property: Type of connector.
     *
     * @return the connectorType value.
     */
    public ConnectorTypes connectorType() {
        return this.connectorType;
    }

    /**
     * Set the connectorType property: Type of connector.
     *
     * @param connectorType the connectorType value to set.
     * @return the Connector object itself.
     */
    public Connector withConnectorType(ConnectorTypes connectorType) {
        this.connectorType = connectorType;
        return this;
    }

    /**
     * Get the displayName property: Display name of the connector.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Display name of the connector.
     *
     * @param displayName the displayName value to set.
     * @return the Connector object itself.
     */
    public Connector withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

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

    /**
     * Set the description property: Description of the connector.
     *
     * @param description the description value to set.
     * @return the Connector object itself.
     */
    public Connector withDescription(String description) {
        this.description = description;
        return this;
    }

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

    /**
     * Set the connectorProperties property: The connector properties.
     *
     * @param connectorProperties the connectorProperties value to set.
     * @return the Connector object itself.
     */
    public Connector withConnectorProperties(Map<String, Object> connectorProperties) {
        this.connectorProperties = connectorProperties;
        return this;
    }

    /**
     * Get the created property: The created time.
     *
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

    /**
     * Get the lastModified property: The last modified time.
     *
     * @return the lastModified value.
     */
    public OffsetDateTime lastModified() {
        return this.lastModified;
    }

    /**
     * Get the state property: State of connector.
     *
     * @return the state value.
     */
    public ConnectorStates state() {
        return this.state;
    }

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

    /**
     * Get the isInternal property: If this is an internal connector.
     *
     * @return the isInternal value.
     */
    public Boolean isInternal() {
        return this.isInternal;
    }

    /**
     * Set the isInternal property: If this is an internal connector.
     *
     * @param isInternal the isInternal value to set.
     * @return the Connector object itself.
     */
    public Connector withIsInternal(Boolean isInternal) {
        this.isInternal = isInternal;
        return this;
    }

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

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