# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Transforms.ColumnSelector
"""


from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist


def transforms_columnselector(
        data,
        output_data=None,
        model=None,
        keep_columns=None,
        drop_columns=None,
        keep_hidden=False,
        ignore_missing=False,
        **params):
    """
    **Description**
        Selects a set of columns, dropping all others

    :param keep_columns: List of columns to keep. (inputs).
    :param data: Input dataset (inputs).
    :param drop_columns: List of columns to drop. (inputs).
    :param keep_hidden: Specifies whether to keep or remove hidden
        columns. (inputs).
    :param ignore_missing: Specifies whether to ignore columns that
        are missing from the input. (inputs).
    :param output_data: Transformed dataset (outputs).
    :param model: Transform model (outputs).
    """

    entrypoint_name = 'Transforms.ColumnSelector'
    inputs = {}
    outputs = {}

    if keep_columns is not None:
        inputs['KeepColumns'] = try_set(
            obj=keep_columns,
            none_acceptable=True,
            is_of_type=list,
            is_column=True)
    if data is not None:
        inputs['Data'] = try_set(
            obj=data,
            none_acceptable=False,
            is_of_type=str)
    if drop_columns is not None:
        inputs['DropColumns'] = try_set(
            obj=drop_columns,
            none_acceptable=True,
            is_of_type=list,
            is_column=True)
    if keep_hidden is not None:
        inputs['KeepHidden'] = try_set(
            obj=keep_hidden,
            none_acceptable=True,
            is_of_type=bool)
    if ignore_missing is not None:
        inputs['IgnoreMissing'] = try_set(
            obj=ignore_missing,
            none_acceptable=True,
            is_of_type=bool)
    if output_data is not None:
        outputs['OutputData'] = try_set(
            obj=output_data,
            none_acceptable=False,
            is_of_type=str)
    if model is not None:
        outputs['Model'] = try_set(
            obj=model,
            none_acceptable=False,
            is_of_type=str)

    input_variables = {
        x for x in unlist(inputs.values())
        if isinstance(x, str) and x.startswith("$")}
    output_variables = {
        x for x in unlist(outputs.values())
        if isinstance(x, str) and x.startswith("$")}

    entrypoint = EntryPoint(
        name=entrypoint_name, inputs=inputs, outputs=outputs,
        input_variables=input_variables,
        output_variables=output_variables)
    return entrypoint
