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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Connector mapping property structure. */
@Fluent
public final class ConnectorMappingStructure {
    /*
     * The property name of the mapping entity.
     */
    @JsonProperty(value = "propertyName", required = true)
    private String propertyName;

    /*
     * The column name of the import file.
     */
    @JsonProperty(value = "columnName", required = true)
    private String columnName;

    /*
     * Custom format specifier for input parsing.
     */
    @JsonProperty(value = "customFormatSpecifier")
    private String customFormatSpecifier;

    /*
     * Indicates if the column is encrypted.
     */
    @JsonProperty(value = "isEncrypted")
    private Boolean isEncrypted;

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

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

    /**
     * Set the propertyName property: The property name of the mapping entity.
     *
     * @param propertyName the propertyName value to set.
     * @return the ConnectorMappingStructure object itself.
     */
    public ConnectorMappingStructure withPropertyName(String propertyName) {
        this.propertyName = propertyName;
        return this;
    }

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

    /**
     * Set the columnName property: The column name of the import file.
     *
     * @param columnName the columnName value to set.
     * @return the ConnectorMappingStructure object itself.
     */
    public ConnectorMappingStructure withColumnName(String columnName) {
        this.columnName = columnName;
        return this;
    }

    /**
     * Get the customFormatSpecifier property: Custom format specifier for input parsing.
     *
     * @return the customFormatSpecifier value.
     */
    public String customFormatSpecifier() {
        return this.customFormatSpecifier;
    }

    /**
     * Set the customFormatSpecifier property: Custom format specifier for input parsing.
     *
     * @param customFormatSpecifier the customFormatSpecifier value to set.
     * @return the ConnectorMappingStructure object itself.
     */
    public ConnectorMappingStructure withCustomFormatSpecifier(String customFormatSpecifier) {
        this.customFormatSpecifier = customFormatSpecifier;
        return this;
    }

    /**
     * Get the isEncrypted property: Indicates if the column is encrypted.
     *
     * @return the isEncrypted value.
     */
    public Boolean isEncrypted() {
        return this.isEncrypted;
    }

    /**
     * Set the isEncrypted property: Indicates if the column is encrypted.
     *
     * @param isEncrypted the isEncrypted value to set.
     * @return the ConnectorMappingStructure object itself.
     */
    public ConnectorMappingStructure withIsEncrypted(Boolean isEncrypted) {
        this.isEncrypted = isEncrypted;
        return this;
    }

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

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