/* Essentials YOOtheme Pro 2.2.16 build 0813.1608; ZOOlanders https://www.zoolanders.com; Copyright (C) Joolanders, SL; http://www.gnu.org/licenses/gpl.html GNU/GPL */

import api from '@yootheme/api';
import essentials from '../api';

export default {
    name: 'ConditionModel',

    data: () => ({
        rules: essentials.customizer?.condition_rules || [],
    }),

    computed: {
        conditionPanel() {
            return api.customizer.panels['yooessentials-condition'];
        },
    },

    methods: {
        openConditionPanel(props) {
            if (!this.conditionPanel) {
                throw new Error('Condition Panel Not Found');
            }

            this.$trigger('openDynamicPanel', {
                ...this.conditionPanel,
                width: 450,
                props,
            });
        },
    },
};
