<script lang="ts">
    import {
        CATEGORICALS,
        TIMESTAMPS,
        INTEGERS,
        INTERVALS,
        FLOATS,
        BOOLEANS
    } from './pandas-data-types';

    import CategoricalType from '../icons/CategoricalType.svelte';
    import TimestampType from '../icons/TimestampType.svelte';
    import BooleanType from '../icons/BooleanType.svelte';
    import IntegerType from '../icons/IntegerType.svelte';
    import FloatType from '../icons/FloatType.svelte';
    export let color = 'text-gray-400';
    export let type: string;
    // export let suppressTooltip = false;

    function typeToSymbol(fieldType: string) {
        if (INTEGERS.has(fieldType)) {
            return IntegerType;
        } else if (FLOATS.has(fieldType)) {
            return FloatType;
        } else if (CATEGORICALS.has(fieldType)) {
            return CategoricalType;
        } else if (TIMESTAMPS.has(fieldType) || INTERVALS.has(type)) {
            return TimestampType;
        } else if (BOOLEANS.has(fieldType)) {
            return BooleanType;
        }
    }
</script>

<div
    class="
    {color}
    grid place-items-center rounded"
    style="width: 16px; height: 16px;"
>
    <div>
        <svelte:component this={typeToSymbol(type)} size="16px" />
    </div>
</div>
