<?php
/**
 * Magento Cart View Configuration
 * 
 * This file defines customizations for the cart view including tabs, buttons,
 * and sections that will be merged into the global admin_views configuration.
 */

return [
    'tabs' => [
        [
            'label' => 'Magento Sync',
            'content' => 'viewtabs/_magento_sync_tab',
            'active' => false,
            'weight' => 400,
            'enabled' => true,
            'conditions' => [
                'magento_enabled' => true,
            ],
            'module' => 'magento',
        ],
        [
            'label' => 'Magento Orders',
            'content' => 'viewtabs/_magento_orders_tab',
            'active' => false,
            'weight' => 410,
            'enabled' => true,
            'conditions' => [
                'magento_enabled' => true,
                'status' => ['Complete', 'Ordered'],
            ],
            'module' => 'magento',
        ],
        [
            'label' => 'Product Sync Status',
            'content' => 'viewtabs/_magento_product_sync_tab',
            'active' => false,
            'weight' => 420,
            'enabled' => false, // Disabled by default as example
            'conditions' => [
                'magento_enabled' => true,
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'magento',
        ],
    ],
    'buttons' => [
        [
            'label' => 'Sync to Magento',
            'class' => 'nav-link btn bg-primary text-white w-100 mb-1',
            'id' => 'sync-magento-btn',
            'onclick' => 'syncToMagento(this.dataset.cartId)',
            'weight' => 400,
            'enabled' => true,
            'conditions' => [
                'magento_enabled' => true,
                'billingstatus' => 'paid',
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'magento',
        ],
        [
            'label' => 'Create Magento Order',
            'class' => 'nav-link btn bg-success text-white w-100 mb-1',
            'id' => 'create-magento-order-btn',
            'onclick' => 'createMagentoOrder(this.dataset.cartId)',
            'weight' => 410,
            'enabled' => true,
            'conditions' => [
                'magento_enabled' => true,
                'status' => ['Complete'],
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'magento',
        ],
        [
            'label' => 'Check Magento Stock',
            'class' => 'nav-link btn bg-warning text-white w-100 mb-1',
            'id' => 'check-magento-stock-btn',
            'onclick' => 'checkMagentoStock(this.dataset.cartId)',
            'weight' => 420,
            'enabled' => true,
            'conditions' => [
                'magento_enabled' => true,
                'user_groups' => ['Global Admins', 'Sales Admin', 'Stock Control'],
            ],
            'module' => 'magento',
        ],
        [
            'label' => 'Update Magento Customer',
            'class' => 'nav-link btn bg-info text-white w-100 mb-1',
            'id' => 'update-magento-customer-btn',
            'onclick' => 'updateMagentoCustomer(this.dataset.cartId)',
            'weight' => 430,
            'enabled' => false, // Disabled by default as example
            'conditions' => [
                'magento_enabled' => true,
                'billingstatus' => 'paid',
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'magento',
        ],
    ],
];