<script setup>
import { useChartData } from '@/composables/useChartData'
import VitalChart from './VitalChart.vue'

const props = defineProps({
  observations: { type: Array, required: true },
  medications: { type: Array, default: () => [] },
  code: { type: String, required: true },
  title: { type: String, required: true },
  yMin: { type: Number, default: undefined },
  yMax: { type: Number, default: undefined },
})

const { chartData } = useChartData(() => props.observations, props.code)
</script>

<template>
  <VitalChart
    :chart-data="chartData"
    :title="title"
    :y-min="yMin"
    :y-max="yMax"
    :observations="observations"
    :observation-code="code"
    :medications="medications"
  />
</template>
