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

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Featurization Configuration. */
@Fluent
public final class TableVerticalFeaturizationSettings extends FeaturizationSettings {
    /*
     * These transformers shall not be used in featurization.
     */
    @JsonProperty(value = "blockedTransformers")
    private List<BlockedTransformers> blockedTransformers;

    /*
     * Dictionary of column name and its type (int, float, string, datetime etc).
     */
    @JsonProperty(value = "columnNameAndTypes")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> columnNameAndTypes;

    /*
     * Determines whether to use Dnn based featurizers for data featurization.
     */
    @JsonProperty(value = "enableDnnFeaturization")
    private Boolean enableDnnFeaturization;

    /*
     * Featurization mode - User can keep the default 'Auto' mode and AutoML will take care of necessary transformation
     * of the data in featurization phase.
     * If 'Off' is selected then no featurization is done.
     * If 'Custom' is selected then user can specify additional inputs to customize how featurization is done.
     */
    @JsonProperty(value = "mode")
    private FeaturizationMode mode;

    /*
     * User can specify additional transformers to be used along with the columns to which it would be applied and
     * parameters for the transformer constructor.
     */
    @JsonProperty(value = "transformerParams")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, List<ColumnTransformer>> transformerParams;

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

    /**
     * Get the blockedTransformers property: These transformers shall not be used in featurization.
     *
     * @return the blockedTransformers value.
     */
    public List<BlockedTransformers> blockedTransformers() {
        return this.blockedTransformers;
    }

    /**
     * Set the blockedTransformers property: These transformers shall not be used in featurization.
     *
     * @param blockedTransformers the blockedTransformers value to set.
     * @return the TableVerticalFeaturizationSettings object itself.
     */
    public TableVerticalFeaturizationSettings withBlockedTransformers(List<BlockedTransformers> blockedTransformers) {
        this.blockedTransformers = blockedTransformers;
        return this;
    }

    /**
     * Get the columnNameAndTypes property: Dictionary of column name and its type (int, float, string, datetime etc).
     *
     * @return the columnNameAndTypes value.
     */
    public Map<String, String> columnNameAndTypes() {
        return this.columnNameAndTypes;
    }

    /**
     * Set the columnNameAndTypes property: Dictionary of column name and its type (int, float, string, datetime etc).
     *
     * @param columnNameAndTypes the columnNameAndTypes value to set.
     * @return the TableVerticalFeaturizationSettings object itself.
     */
    public TableVerticalFeaturizationSettings withColumnNameAndTypes(Map<String, String> columnNameAndTypes) {
        this.columnNameAndTypes = columnNameAndTypes;
        return this;
    }

    /**
     * Get the enableDnnFeaturization property: Determines whether to use Dnn based featurizers for data featurization.
     *
     * @return the enableDnnFeaturization value.
     */
    public Boolean enableDnnFeaturization() {
        return this.enableDnnFeaturization;
    }

    /**
     * Set the enableDnnFeaturization property: Determines whether to use Dnn based featurizers for data featurization.
     *
     * @param enableDnnFeaturization the enableDnnFeaturization value to set.
     * @return the TableVerticalFeaturizationSettings object itself.
     */
    public TableVerticalFeaturizationSettings withEnableDnnFeaturization(Boolean enableDnnFeaturization) {
        this.enableDnnFeaturization = enableDnnFeaturization;
        return this;
    }

    /**
     * Get the mode property: Featurization mode - User can keep the default 'Auto' mode and AutoML will take care of
     * necessary transformation of the data in featurization phase. If 'Off' is selected then no featurization is done.
     * If 'Custom' is selected then user can specify additional inputs to customize how featurization is done.
     *
     * @return the mode value.
     */
    public FeaturizationMode mode() {
        return this.mode;
    }

    /**
     * Set the mode property: Featurization mode - User can keep the default 'Auto' mode and AutoML will take care of
     * necessary transformation of the data in featurization phase. If 'Off' is selected then no featurization is done.
     * If 'Custom' is selected then user can specify additional inputs to customize how featurization is done.
     *
     * @param mode the mode value to set.
     * @return the TableVerticalFeaturizationSettings object itself.
     */
    public TableVerticalFeaturizationSettings withMode(FeaturizationMode mode) {
        this.mode = mode;
        return this;
    }

    /**
     * Get the transformerParams property: User can specify additional transformers to be used along with the columns to
     * which it would be applied and parameters for the transformer constructor.
     *
     * @return the transformerParams value.
     */
    public Map<String, List<ColumnTransformer>> transformerParams() {
        return this.transformerParams;
    }

    /**
     * Set the transformerParams property: User can specify additional transformers to be used along with the columns to
     * which it would be applied and parameters for the transformer constructor.
     *
     * @param transformerParams the transformerParams value to set.
     * @return the TableVerticalFeaturizationSettings object itself.
     */
    public TableVerticalFeaturizationSettings withTransformerParams(
        Map<String, List<ColumnTransformer>> transformerParams) {
        this.transformerParams = transformerParams;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TableVerticalFeaturizationSettings withDatasetLanguage(String datasetLanguage) {
        super.withDatasetLanguage(datasetLanguage);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (transformerParams() != null) {
            transformerParams()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.forEach(e1 -> e1.validate());
                        }
                    });
        }
    }
}
