<template>
  <kuc-combobox
    :items="items"
    :value="modelValue"
    @change="updateValue"
    :disabled="selectedAppData.loading == undefined ? false : selectedAppData.loading"
  />
</template>

<script setup lang="ts">
import type { CachedSelectedAppData } from '@/types/model';
import type { KucEvent } from '@/types/my-kintone';
import type { DropdownItem } from 'kintone-ui-component';
import { defineProps, defineEmits } from 'vue';

const props = defineProps<{
  items: DropdownItem[];
  modelValue: string;
  selectedAppData: CachedSelectedAppData;
}>();

const emit = defineEmits<{
  (e: 'update:modelValue', value: string): void;
}>();

const updateValue = (event: KucEvent) => {
  emit('update:modelValue', event.detail.value);
};
</script>
