import { ReactSelectProps } from '@/types';
import { Select } from './Select';

const OPTION_KATEGORI = [
    { label: '1 : AKTIVA', value: 'AKTIVA' },
    { label: '2 : PASIVA', value: 'PASIVA' },
    { label: '3 : PENDAPATAN', value: 'PENDAPATAN' },
    { label: '4 : BIAYA', value: 'BIAYA' },
];

export const SelectKategoriJurnal = (props: ReactSelectProps) => {
    const value = OPTION_KATEGORI.find((item) => item.value === props.value);

    return (
        <Select
            defaultValue={value}
            options={OPTION_KATEGORI}
            isDisabled={props.disable}
            placeholder="Pilih Kategori Jurnal"
            onChange={(newValue: unknown) => {
                const option = newValue as { label: string; value: string };
                props.onChange?.(option?.value);
            }}
        />
    );
};
