import { useMemo } from 'react';

import _ from 'lodash';

import ShortViewLL from '@/components/ShortViewLL';
import { Badge } from '@/components/ui/badge';

import { TableItemProps } from '../TableItem';
import EmptyItem from './EmptyItem';

const EnumsItem = (props: TableItemProps) => {

    const value = props.value;

    const values = useMemo(() => {
        return props.structure?.itemType?.values?.[value] as any;
    }, [props.structure, value]);




    if (!value || _.size(value) == 0) {
        return <EmptyItem {...props} />;
    }





    return <div>
        {_.map(value, (val, index) => {

            return <Badge variant="secondary"><ShortViewLL value={values?.[val] ?? ''} /></Badge>

        })}

    </div>


}

export default EnumsItem;