<?php

/**
 * Admin sidebar navigation schema.
 *
 * Each section has a label and a list of items. Each item has:
 *   - id     : stable string used to mark the active row from a page
 *   - label  : sidebar label (also used in command palette + tooltips)
 *   - icon   : icon name from app/View/Components/Icon.php's CATALOG
 *   - href   : URL (use route() in the controller / view component if needed)
 *   - count  : optional number badge
 *   - alert  : optional warning dot
 *   - items  : optional nested array of items
 *
 * This file is the canonical source for both the rendered sidebar and the
 * command palette's "Pages" scope.
 */

return [
    [
        'label' => 'Operations',
        'items' => [
            ['id' => 'dashboard', 'label' => 'Dashboard', 'icon' => 'dashboard', 'href' => '/admin'],
            ['id' => 'cashier',   'label' => 'POS',       'icon' => 'pos',       'href' => '/cashier',         'permission' => 'sales.create'],
        ],
    ],
    [
        'label' => 'Sales',
        'items' => [
            ['id' => 'sales',             'label' => 'Sales History',     'icon' => 'receipt', 'href' => '/admin/sales',             'permission' => 'sales.view_own'],
            ['id' => 'kiosk-orders',      'label' => 'Kiosk orders',      'icon' => 'pos',     'href' => '/admin/kiosk-orders',      'permission' => 'sales.view_own'],
            ['id' => 'customer-payments', 'label' => 'Customer payments', 'icon' => 'cash',    'href' => '/admin/customer-payments', 'permission' => 'customers.payments_record'],
            ['id' => 'return-reasons',    'label' => 'Return reasons',    'icon' => 'refund',  'href' => '/admin/return-reasons',    'permission' => 'sales.refund'],
        ],
    ],
    [
        'label' => 'Customers',
        'items' => [
            ['id' => 'customers',       'label' => 'Customers',       'icon' => 'customers', 'href' => '/admin/customers',       'permission' => 'customers.view'],
            ['id' => 'customer-groups', 'label' => 'Customer groups', 'icon' => 'grip',      'href' => '/admin/customer-groups', 'permission' => 'customers.view'],
        ],
    ],
    [
        'label' => 'Shifts',
        'items' => [
            [
                'id' => 'shifts-group', 'label' => 'Shifts', 'icon' => 'clock',
                'items' => [
                    ['id' => 'shifts',                 'label' => 'Shift History',        'icon' => 'clock', 'href' => '/admin/shifts',                  'permission' => 'shifts.open'],
                    ['id' => 'shift-variance-reasons', 'label' => 'Cash Mismatch Reasons','icon' => 'bar',   'href' => '/admin/shift-variance-reasons', 'permission' => 'shifts.close_others'],
                ]
            ],
        ],
    ],
    [
        'label' => 'Products',
        'items' => [
            [
                'id' => 'catalog-group', 'label' => 'Products', 'icon' => 'box',
                'items' => [
                    ['id' => 'products',   'label' => 'Products',   'icon' => 'box',  'href' => '/admin/products', 'permission' => 'products.view'],
                    ['id' => 'product-labels', 'label' => 'Print labels', 'icon' => 'barcode', 'href' => '/admin/products/labels', 'permission' => 'products.view'],
                    ['id' => 'categories', 'label' => 'Categories', 'icon' => 'tree', 'href' => '/admin/categories', 'permission' => 'taxonomies.manage'],
                    ['id' => 'brands',     'label' => 'Brands',     'icon' => 'star', 'href' => '/admin/brands', 'permission' => 'taxonomies.manage'],
                    ['id' => 'units',            'label' => 'Units',               'icon' => 'grip', 'href' => '/admin/units',            'permission' => 'taxonomies.manage'],
                    ['id' => 'unit-categories',  'label' => 'Measurement categories', 'icon' => 'tag', 'href' => '/admin/units/categories', 'permission' => 'taxonomies.manage'],
                ]
            ],
        ],
    ],
    [
        'label' => 'Inventory',
        'items' => [
            [
                'id' => 'inventory-group', 'label' => 'Inventory', 'icon' => 'archive',
                'items' => [
                    ['id' => 'stock-levels',        'label' => 'Available Stock',     'icon' => 'database',  'href' => '/admin/inventory/levels',              'permission' => 'products.view'],
                    ['id' => 'low-stock',           'label' => 'Low stock',           'icon' => 'alert',     'href' => '/admin/inventory/low-stock',           'permission' => 'products.view'],
                    ['id' => 'batches',             'label' => 'Batches & expiry',    'icon' => 'clock',     'href' => '/admin/inventory/batches',             'permission' => 'products.view'],
                    ['id' => 'stock-adjustments',   'label' => 'Stock adjustments',   'icon' => 'edit',      'href' => '/admin/inventory/adjustments',         'permission' => 'products.adjust_stock'],
                    ['id' => 'stock-takes',         'label' => 'Stock Reconciliation','icon' => 'check-all', 'href' => '/admin/inventory/stock-takes',         'permission' => 'products.adjust_stock'],
                    ['id' => 'stock-movements',     'label' => 'Stock Activity',      'icon' => 'refresh',   'href' => '/admin/inventory/movements',           'permission' => 'products.view'],
                    ['id' => 'stock-transfers',     'label' => 'Stock transfers',     'icon' => 'external',  'href' => '/admin/inventory/transfers',            'permission' => 'products.transfer_stock'],
                    ['id' => 'adjustment-reasons',  'label' => 'Adjustment reasons',  'icon' => 'note',      'href' => '/admin/inventory/adjustment-reasons',  'permission' => 'products.adjust_stock'],
                ]
            ],
        ],
    ],
    [
        'label' => 'Purchase & Suppliers',
        'items' => [
            [
                'id' => 'supply-group', 'label' => 'Purchase & Suppliers', 'icon' => 'truck',
                'items' => [
                    ['id' => 'suppliers',        'label' => 'Suppliers',         'icon' => 'truck',  'href' => '/admin/suppliers',        'permission' => 'suppliers.view'],
                    ['id' => 'purchases',        'label' => 'Purchases',         'icon' => 'cart',   'href' => '/admin/purchases',        'permission' => 'purchases.view'],
                    ['id' => 'purchase-returns', 'label' => 'Purchase returns',  'icon' => 'refund', 'href' => '/admin/purchase-returns', 'permission' => 'purchases.view'],
                    ['id' => 'supplier-payments','label' => 'Supplier payments', 'icon' => 'card',   'href' => '/admin/supplier-payments','permission' => 'suppliers.view'],
                    ['id' => 'expenses',           'label' => 'Expenses',          'icon' => 'cash',   'href' => '/admin/expenses',           'permission' => 'expenses.view'],
                    ['id' => 'expense-categories', 'label' => 'Expense categories','icon' => 'tag',    'href' => '/admin/expense-categories', 'permission' => 'expenses.view'],
                ]
            ],
        ],
    ],
    [
        'label' => 'Reports',
        'items' => [
            [
                'id' => 'insights-group', 'label' => 'Reports', 'icon' => 'pie',
                'items' => [
                    ['id' => 'reports-hub',             'label' => 'All reports',          'icon' => 'pie',      'href' => '/admin/reports',                        'permission' => 'reports.view_financial'],
                    ['id' => 'sales-report',            'label' => 'Sales summary',        'icon' => 'trending', 'href' => '/admin/reports/sales',                  'permission' => 'reports.view_financial'],
                    ['id' => 'sales-by-product',        'label' => 'Sales by product',     'icon' => 'bar',      'href' => '/admin/reports/sales-by-product',       'permission' => 'reports.view_financial'],
                    ['id' => 'sales-by-cashier',        'label' => 'Sales by cashier',     'icon' => 'user',     'href' => '/admin/reports/sales-by-cashier',       'permission' => 'reports.view_sales'],
                    ['id' => 'sales-by-payment-method', 'label' => 'Sales by payment',     'icon' => 'card',     'href' => '/admin/reports/sales-by-payment-method','permission' => 'reports.view_sales'],
                    ['id' => 'sales-by-category',       'label' => 'Sales by category',    'icon' => 'tree',     'href' => '/admin/reports/sales-by-category',      'permission' => 'reports.view_sales'],
                    ['id' => 'discounts',               'label' => 'Discounts',            'icon' => 'tag',      'href' => '/admin/reports/discounts',              'permission' => 'reports.view_sales'],
                    ['id' => 'top-customers',           'label' => 'Top customers',        'icon' => 'customers','href' => '/admin/reports/top-customers',          'permission' => 'reports.view_customers'],
                    ['id' => 'top-suppliers',           'label' => 'Top suppliers',        'icon' => 'truck',    'href' => '/admin/reports/top-suppliers',          'permission' => 'reports.view_suppliers'],
                    ['id' => 'shifts-by-cashier',       'label' => 'Shifts by cashier',    'icon' => 'clock',    'href' => '/admin/reports/shifts-by-cashier',      'permission' => 'reports.view_employees'],
                    ['id' => 'aged-receivables',        'label' => 'Aged receivables',     'icon' => 'cash',     'href' => '/admin/reports/aged-receivables',       'permission' => 'reports.view_financial'],
                    ['id' => 'saved-reports',           'label' => 'Saved reports',        'icon' => 'star',     'href' => '/admin/reports/saved',                  'permission' => 'reports.view_financial'],
                    ['id' => 'sync-log',                'label' => 'Sync log',             'icon' => 'refresh',  'href' => '/admin/sync-log',                       'permission' => 'sync.log.view'],
                ]
            ],
        ],
    ],
    [
        'label' => 'Accounting',
        'items' => [
            ['id' => 'journal',           'label' => 'Journal',           'icon' => 'note',       'href' => '/admin/accounting/journal',            'permission' => 'accounting.view'],
            ['id' => 'chart-of-accounts', 'label' => 'Chart of accounts', 'icon' => 'list',       'href' => '/admin/accounting/chart-of-accounts',  'permission' => 'accounting.view'],
            ['id' => 'business-mappings', 'label' => 'Business mappings', 'icon' => 'external',   'href' => '/admin/accounting/mappings',           'permission' => 'accounting.view'],
            ['id' => 'fiscal-periods',    'label' => 'Fiscal periods',    'icon' => 'lock',       'href' => '/admin/accounting/periods',            'permission' => 'accounting.view'],
            ['id' => 'opening-balances',  'label' => 'Opening balances',  'icon' => 'calculator', 'href' => '/admin/accounting/opening-balances',   'permission' => 'accounting.opening_balances'],
        ],
    ],
    [
        'label' => 'Tax Management',
        'items' => [
            ['id' => 'tax-components',      'label' => 'Tax components',      'icon' => 'tag',  'href' => '/admin/settings/tax/components',      'permission' => 'settings.tax.view'],
            ['id' => 'tax-groups',          'label' => 'Tax groups',          'icon' => 'tree', 'href' => '/admin/settings/tax/groups',          'permission' => 'settings.tax.view'],
            ['id' => 'tax-classifications', 'label' => 'Tax classifications', 'icon' => 'list', 'href' => '/admin/settings/tax/classifications', 'permission' => 'settings.tax.view'],
            ['id' => 'drug-schedules',      'label' => 'Drug Schedules',      'icon' => 'note', 'href' => '/admin/drug-schedules',               'permission' => 'taxonomies.manage'],
        ],
    ],
    [
        'label' => 'User & Access Management',
        'items' => [
            ['id' => 'users', 'label' => 'Users', 'icon' => 'user',   'href' => '/admin/users', 'permission' => 'users.view'],
            ['id' => 'roles', 'label' => 'Roles', 'icon' => 'shield', 'href' => '/admin/roles', 'permission' => 'roles.manage'],
        ],
    ],
    [
        'label' => 'System Configuration',
        'items' => [
            ['id' => 'stores',    'label' => 'Stores',           'icon' => 'store',    'href' => '/admin/stores',    'permission' => 'stores.view'],
            ['id' => 'terminals', 'label' => 'Terminals',        'icon' => 'pos',      'href' => '/admin/terminals', 'permission' => 'terminals.view'],
            ['id' => 'hardware',  'label' => 'Hardware',         'icon' => 'printer',  'href' => '/admin/settings/hardware', 'permission' => 'hardware.diagnostics'],
            ['id' => 'system-health', 'label' => 'System Health', 'icon' => 'shield',  'href' => '/admin/settings/system-health', 'permission' => 'settings.view'],
            ['id' => 'languages', 'label' => 'Languages',        'icon' => 'globe',    'href' => '/admin/languages', 'permission' => 'settings.view'],
            ['id' => 'settings',  'label' => 'General settings', 'icon' => 'settings', 'href' => '/admin/settings',  'permission' => 'settings.view'],
        ],
    ],
];
