<script>
import { markRaw } from 'vue'

import DefaultModal from '@inside-library/components/modals/default/DefaultModal'
import ParagraphListing from '@inside-library/components/listing/ParagraphListing'

export default {
  name: 'domain-modal',
  extends: DefaultModal,
  data() {
    return {
      selection: {
        title: 'title',
        content: 'content'
      }
    }
  },
  methods: {
    scaffold(fields) {
      return {
        title: fields.title,
        sections: [
          {
            fields: [
              ...this.insertIf(!!fields.content, {
                id: 'content',
                tag: markRaw(ParagraphListing),
                data: {
                  heritedData: fields.content,
                  heritedOptions: { template: true }
                }
              })
            ]
          }
        ]
      }
    }
  }
}
</script>
