<script setup lang="ts">
import { DropdownMenuCheckboxItem as ShadcnDropdownMenuCheckboxItem } from '@/components/core/dropdown-menu';
import type { UiDropdownMenuCheckboxItemProps } from './types';

defineOptions({
  name: 'UiDropdownMenuCheckboxItem',
});

const props = defineProps<UiDropdownMenuCheckboxItemProps>();

// Use 'checked' as our public API, map to 'modelValue' internally
const emit = defineEmits<{
  /** Emitted when the checked state changes. */
  'update:checked': [value: boolean];
}>();
</script>

<template>
  <ShadcnDropdownMenuCheckboxItem
    :model-value="props.checked"
    :disabled="props.disabled"
    :text-value="props.textValue"
    @update:model-value="emit('update:checked', $event)"
  >
    <template v-if="$slots['indicator-icon']" #indicator-icon>
      <slot name="indicator-icon" />
    </template>
    <slot />
  </ShadcnDropdownMenuCheckboxItem>
</template>
