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

import numbers

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


def transforms_categoricalhashonehotvectorizer(
        column,
        data,
        output_data=None,
        model=None,
        hash_bits=16,
        output_kind='Bag',
        seed=314489979,
        ordered=True,
        invert_hash=0,
        **params):
    """
    **Description**
        Converts the categorical value into an indicator array by hashing the
        value and using the hash as an index in the bag. If the input
        column is a vector, a single indicator bag is returned for
        it.

    :param column: New column definition(s) (optional form:
        name:hashBits:src) (inputs).
    :param data: Input dataset (inputs).
    :param hash_bits: Number of bits to hash into. Must be between 1
        and 30, inclusive. (inputs).
    :param output_kind: Output kind: Bag (multi-set vector), Ind
        (indicator vector), or Key (index) (inputs).
    :param seed: Hashing seed (inputs).
    :param ordered: Whether the position of each term should be
        included in the hash (inputs).
    :param invert_hash: Limit the number of keys used to generate the
        slot name to this many. 0 means no invert hashing, -1 means
        no limit. (inputs).
    :param output_data: Transformed dataset (outputs).
    :param model: Transform model (outputs).
    """

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

    if column is not None:
        inputs['Column'] = try_set(
            obj=column,
            none_acceptable=False,
            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 hash_bits is not None:
        inputs['HashBits'] = try_set(
            obj=hash_bits,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if output_kind is not None:
        inputs['OutputKind'] = try_set(
            obj=output_kind,
            none_acceptable=True,
            is_of_type=str,
            values=[
                'Bag',
                'Ind',
                'Key',
                'Bin'])
    if seed is not None:
        inputs['Seed'] = try_set(
            obj=seed,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if ordered is not None:
        inputs['Ordered'] = try_set(
            obj=ordered,
            none_acceptable=True,
            is_of_type=bool)
    if invert_hash is not None:
        inputs['InvertHash'] = try_set(
            obj=invert_hash,
            none_acceptable=True,
            is_of_type=numbers.Real)
    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
