import { computed } from 'vue'
import CipDynamicImage from '@cip/components/cip-dynamic-image'
import CipDynamicVideo from '@cip/components/cip-dynamic-video'
export default {
  props: {
    type: { type: String, default: 'image', validate: (val) => ['video', 'image'].includes(val) },
    src: String
  },
  setup (props) {
    const Component = computed(() => {
      return props.type === 'video' ? CipDynamicVideo : CipDynamicImage
    })
    return () => <Component.value src={props.src}></Component.value>
  }
}
