<script setup lang="ts">
import { SimplifiedWidget } from '@/types/simplifiedWidget'

import WidgetInputNumberInput from './WidgetInputNumberInput.vue'
import WidgetInputNumberSlider from './WidgetInputNumberSlider.vue'

defineProps<{
  widget: SimplifiedWidget<number>
  readonly?: boolean
}>()

const modelValue = defineModel<number>({ default: 0 })
</script>

<template>
  <component
    :is="
      widget.type === 'slider'
        ? WidgetInputNumberSlider
        : WidgetInputNumberInput
    "
    v-model="modelValue"
    :widget="widget"
    :readonly="readonly"
    v-bind="$attrs"
  />
</template>
