import _ from 'lodash';

import ShortViewText from '@/components/ShortViewText';
import { Badge } from '@/components/ui/badge';
import { cn } from '@/lib/utils';

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

const EnumItem = (props: TableItemProps) => {

    const value = props.value;

    const values = props.structure?.values;
    const tokens = props.boardTokens;




    if (!value || !values?.[value]) {
        return <EmptyItem {...props} />;
    }






    return <div><Badge
        variant={"secondary"}
        className={tokens ? 'py-0' : undefined}
    >

        <ShortViewText
            className={cn(tokens?.valueClass)}
            maxLength={tokens?.shortTextMaxLength ?? 15}
            text={values?.[value]}
        />
    </Badge></div>


}

export default EnumItem;
