<?php

declare(strict_types=1);

/**
 * Module Configuration
 * 
 * Each module can be enabled or disabled via environment variables.
 * All modules default to true (enabled) when the env variable is not set.
 * 
 * Usage:
 *   - Set MODULE_<NAME>_ENABLED=false in .env to disable a module.
 *   - The middleware 'module:<key>' can be applied to route groups.
 *   - Use App\Support\ModuleHelper::isEnabled('key') in code.
 */

return [

    /*
    |--------------------------------------------------------------------------
    | Master System Toggle
    |--------------------------------------------------------------------------
    | If set to false, all module-specific middleware checks will be bypassed.
    | Useful for development or full-feature environments.
    */
    'system_enabled' => (bool) env('MODULES_SYSTEM_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | POS (Point of Sale)
    |--------------------------------------------------------------------------
    | Includes: POS terminal, sessions, item management, stats, access keys
    */
    'pos' => [
        'enabled' => (bool) env('MODULE_POS_ENABLED', true),
        'label'   => 'Point of Sale (POS)',
        'description' => 'POS terminal operations, sessions, sales, and access keys.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Products
    |--------------------------------------------------------------------------
    | Includes: Product CRUD, categories, store assignments, batch add
    */
    'products' => [
        'enabled' => (bool) env('MODULE_PRODUCTS_ENABLED', true),
        'label'   => 'Product Management',
        'description' => 'Product creation, editing, categories, and store assignments.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Stores
    |--------------------------------------------------------------------------
    | Includes: Store CRUD, management, product removal from store
    */
    'stores' => [
        'enabled' => (bool) env('MODULE_STORES_ENABLED', true),
        'label'   => 'Store Management',
        'description' => 'Store creation, editing, and product-store relationships.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Shipments
    |--------------------------------------------------------------------------
    | Includes: Shipment tracking, couriers, status updates
    */
    'shipments' => [
        'enabled' => (bool) env('MODULE_SHIPMENTS_ENABLED', true),
        'label'   => 'Shipments & Logistics',
        'description' => 'Shipment tracking, courier management, and delivery status.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Farmers
    |--------------------------------------------------------------------------
    | Includes: Farmer registration, listing, verification, organizations
    */
    'farmers' => [
        'enabled' => (bool) env('MODULE_FARMERS_ENABLED', true),
        'label'   => 'Farmer Management',
        'description' => 'Farmer registration, profile management, and verification.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Cooperatives
    |--------------------------------------------------------------------------
    | Includes: Cooperative CRUD, members, documents, governance, chapters
    */
    'cooperatives' => [
        'enabled' => (bool) env('MODULE_COOPERATIVES_ENABLED', true),
        'label'   => 'Cooperatives & Organizations',
        'description' => 'Cooperative management, membership, documents, and governance.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Accounting
    |--------------------------------------------------------------------------
    | Includes: Account trees, transactions, daily entries, reports
    */
    'accounting' => [
        'enabled' => (bool) env('MODULE_ACCOUNTING_ENABLED', true),
        'label'   => 'Accounting & Finance',
        'description' => 'Chart of accounts, transaction records, and financial reports.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Store-Level Accounting
    |--------------------------------------------------------------------------
    | Controls whether Store Owner / Store Manager can access the Accounting
    | Dashboard and Manage Accounts pages. Big 3 are never affected by this.
    | Toggle via UltimateConsole → Module Controls at runtime.
    */
    'accounting_store' => [
        'enabled' => (bool) env('MODULE_ACCOUNTING_STORE_ENABLED', true),
        'label'   => 'Store Accounting Access',
        'description' => 'Grants Store Owner and Store Manager access to the Accounting Dashboard and their store\'s Chart of Accounts. Disable to hide accounting from store-level users.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Transactions
    |--------------------------------------------------------------------------
    | Includes: Global transaction listing, creation, types
    */
    'transactions' => [
        'enabled' => (bool) env('MODULE_TRANSACTIONS_ENABLED', true),
        'label'   => 'Global Transactions',
        'description' => 'System-wide transaction recording and listing.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Properties
    |--------------------------------------------------------------------------
    | Includes: Property listing, referrals
    */
    'properties' => [
        'enabled' => (bool) env('MODULE_PROPERTIES_ENABLED', true),
        'label'   => 'Property Management',
        'description' => 'Property listings, referrals, and lead management.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Cart
    |--------------------------------------------------------------------------
    | Includes: Shopping cart operations
    */
    'cart' => [
        'enabled' => (bool) env('MODULE_CART_ENABLED', true),
        'label'   => 'Shopping Cart',
        'description' => 'Cart operations for the marketplace.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Credits / Wallet
    |--------------------------------------------------------------------------
    | Includes: Top-up, transfer credit, wallet data
    */
    'credits' => [
        'enabled' => (bool) env('MODULE_CREDITS_ENABLED', true),
        'label'   => 'Credits & Wallet',
        'description' => 'Credit top-up, transfers, and wallet management.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Landing Pages
    |--------------------------------------------------------------------------
    | Includes: Landing page editor, public rendering
    */
    'landing_pages' => [
        'enabled' => (bool) env('MODULE_LANDING_PAGES_ENABLED', true),
        'label'   => 'Landing Pages',
        'description' => 'Custom landing page creation and management.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Announcements
    |--------------------------------------------------------------------------
    | Includes: Announcement CRUD, latest public announcements
    */
    'announcements' => [
        'enabled' => (bool) env('MODULE_ANNOUNCEMENTS_ENABLED', true),
        'label'   => 'Announcements',
        'description' => 'System-wide announcements and notifications.',
    ],

    /*
    |--------------------------------------------------------------------------
    | Batch Operations
    |--------------------------------------------------------------------------
    | Includes: Batch creation of products, stores, users
    */
    'batch' => [
        'enabled' => (bool) env('MODULE_BATCH_ENABLED', true),
        'label'   => 'Batch Operations',
        'description' => 'Bulk creation of products, stores, and user accounts.',
    ],

];
