<template>
  <component :is="component" v-bind="props"/>
</template>

<script setup>
import {computed} from "vue";
import DateBuilder from "@/components/chart/DateBuilder.vue";
import LimitBuilder from "@/components/chart/LimitBuilder.vue";
import MarketBuilder from "@/components/chart/MarketBuilder.vue";
import DiagonalBuilder from "@/components/chart/DiagonalBuilder.vue";
import DCABuilder from "@/components/chart/DCABuilder.vue";

const props = defineProps(['order', 'builder'])

const component = computed(()=>{
  switch (props.builder.component) {
    case 'MarketBuilder':
      return MarketBuilder
    case 'DCABuilder':
      return DCABuilder
    case 'LimitBuilder':
      return LimitBuilder
    case 'DiagonalBuilder':
      return DiagonalBuilder
    case 'DateBuilder':
      return DateBuilder
    default:
      console.error('Unknown builder component '+props.builder.component)
      return null
  }
})
</script>

<style scoped lang="scss">

</style>