<template>
    <ComposableSourceEditor
        ref="editor"
        v-model="value"
        :sources="values.sources"
        :conditions="values.conditions"
    />
</template>

<script>
import Vue from 'vue';
import fields from '@yootheme/fields';
import { ComposableSourceEditor } from '../components';

export default {
    name: 'ComposableSourceField',

    components: {
        ComposableSourceEditor,
    },

    extends: fields.components.FieldText,

    created() {
        if (!this.values.sources) {
            Vue.set(this.values, 'sources', {});
        }

        if (!this.values.conditions) {
            Vue.set(this.values, 'conditions', {});
        }
    },
};
</script>
