<template>
  <div class="file-upload">
    <template v-if="document">
      <document-block
        :value="{url: document}"
        show-trash-icon
        @trash="$emit('change-document-url', '')"
      />

    </template>
    <template v-else>
      <simple-file-upload
        :with-text="withText"
        :value="document"
        @link-change-url="$emit('change-document-url', $event)"
      />

    </template>

  </div>
</template>

<script>
  import DocumentBlock from '@/components/content-blocks/DocumentBlock';
  import SimpleFileUpload from '@/components/ui/file-upload/SimpleFileUpload';

  export default {
    props: {
      document: {
        type: String,
        default: '',
      },
      withText: {
        type: Boolean,
        default: false
      }
    },
    components: {SimpleFileUpload, DocumentBlock},
  };
</script>

<style scoped lang="scss">
  @import '~styles/helpers';

</style>
