<?php

declare(strict_types=1);

/*
|--------------------------------------------------------------------------
| Accounting Themes
|--------------------------------------------------------------------------
|
| Each theme defines a starter Chart of Accounts hierarchy. The active
| theme is stored as a system setting (`accounting_theme`). Accounts are
| stamped with the theme key + a stable code when seeded so drift can be
| compared later. User-created accounts leave those fields null.
|
| There is no default theme — fresh deployments start on `blank` and an
| operator picks a theme from the Ultimate Console.
|
*/

return [

    'blank' => [
        'label' => 'Blank',
        'description' => 'Empty chart. Build the hierarchy from scratch through the admin UI.',
        'version' => 1,
        'tree' => [],
    ],

    'general_business' => [
        'label' => 'General Business',
        'description' => 'Conventional small-business chart of accounts: revenue, COGS, operating expenses, assets, liabilities, equity.',
        'version' => 1,
        'tree' => [
            [
                'name' => 'Revenue',
                'type' => 'REVENUE',
                'children' => [
                    ['name' => 'Sales', 'type' => 'REVENUE'],
                    ['name' => 'Service Income', 'type' => 'REVENUE'],
                    ['name' => 'Other Income', 'type' => 'REVENUE'],
                ],
            ],
            [
                'name' => 'Cost of Goods Sold',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Purchases', 'type' => 'EXPENSE'],
                    ['name' => 'Freight In', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Operating Expenses',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Salaries & Wages', 'type' => 'EXPENSE'],
                    ['name' => 'Rent', 'type' => 'EXPENSE'],
                    ['name' => 'Utilities', 'type' => 'EXPENSE'],
                    ['name' => 'Office Supplies', 'type' => 'EXPENSE'],
                    ['name' => 'Marketing', 'type' => 'EXPENSE'],
                    ['name' => 'Professional Fees', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Assets',
                'type' => 'ASSET',
                'children' => [
                    ['name' => 'Cash on Hand', 'type' => 'ASSET'],
                    ['name' => 'Bank Accounts', 'type' => 'ASSET'],
                    ['name' => 'Accounts Receivable', 'type' => 'ASSET'],
                    ['name' => 'Inventory', 'type' => 'ASSET'],
                ],
            ],
            [
                'name' => 'Liabilities',
                'type' => 'LIABILITY',
                'children' => [
                    ['name' => 'Accounts Payable', 'type' => 'LIABILITY'],
                    ['name' => 'Loans Payable', 'type' => 'LIABILITY'],
                    ['name' => 'Taxes Payable', 'type' => 'LIABILITY'],
                ],
            ],
            [
                'name' => 'Equity',
                'type' => 'EQUITY',
                'children' => [
                    ['name' => "Owner's Capital", 'type' => 'EQUITY'],
                    ['name' => 'Retained Earnings', 'type' => 'EQUITY'],
                ],
            ],
        ],
    ],

    'retail_pos' => [
        'label' => 'Retail / POS',
        'description' => 'Storefront and POS-driven business: sales channels, COGS, inventory shrinkage, store operating costs.',
        'version' => 1,
        'tree' => [
            [
                'name' => 'Sales',
                'type' => 'REVENUE',
                'children' => [
                    ['name' => 'Walk-in Sales', 'type' => 'REVENUE'],
                    ['name' => 'Online Sales', 'type' => 'REVENUE'],
                    ['name' => 'Wholesale', 'type' => 'REVENUE'],
                    ['name' => 'Returns & Refunds', 'type' => 'REVENUE'],
                ],
            ],
            [
                'name' => 'Cost of Sales',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Inventory Purchases', 'type' => 'EXPENSE'],
                    ['name' => 'Shrinkage & Spoilage', 'type' => 'EXPENSE'],
                    ['name' => 'Packaging', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Store Operations',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Store Rent', 'type' => 'EXPENSE'],
                    ['name' => 'Store Utilities', 'type' => 'EXPENSE'],
                    ['name' => 'Cashier Wages', 'type' => 'EXPENSE'],
                    ['name' => 'Payment Processing Fees', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Cash & Equivalents',
                'type' => 'ASSET',
                'children' => [
                    ['name' => 'Register Cash', 'type' => 'ASSET'],
                    ['name' => 'Bank Deposits', 'type' => 'ASSET'],
                ],
            ],
        ],
    ],

    'service_business' => [
        'label' => 'Service Business',
        'description' => 'Service-first business: billable income, contractor and labor costs, lean operating overhead.',
        'version' => 1,
        'tree' => [
            [
                'name' => 'Service Revenue',
                'type' => 'REVENUE',
                'children' => [
                    ['name' => 'Consulting Fees', 'type' => 'REVENUE'],
                    ['name' => 'Project Income', 'type' => 'REVENUE'],
                    ['name' => 'Recurring Retainers', 'type' => 'REVENUE'],
                ],
            ],
            [
                'name' => 'Direct Costs',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Subcontractors', 'type' => 'EXPENSE'],
                    ['name' => 'Billable Labor', 'type' => 'EXPENSE'],
                    ['name' => 'Software & Tools', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Overhead',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Office Rent', 'type' => 'EXPENSE'],
                    ['name' => 'Internet & Phone', 'type' => 'EXPENSE'],
                    ['name' => 'Admin Salaries', 'type' => 'EXPENSE'],
                    ['name' => 'Travel', 'type' => 'EXPENSE'],
                ],
            ],
        ],
    ],

    'agri_coop' => [
        'label' => 'Agricultural Cooperative',
        'description' => 'Farm-gate cooperative: produce sales, supplier capital, logistics, warehouse and member operations.',
        'version' => 1,
        'tree' => [
            [
                'name' => 'Produce Sales',
                'type' => 'REVENUE',
                'children' => [
                    ['name' => 'Direct Buyers', 'type' => 'REVENUE'],
                    ['name' => 'Wholesale Channel', 'type' => 'REVENUE'],
                    ['name' => 'Consignment', 'type' => 'REVENUE'],
                ],
            ],
            [
                'name' => 'Capital & Procurement',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Supplier Advances', 'type' => 'EXPENSE'],
                    ['name' => 'Member Payouts', 'type' => 'EXPENSE'],
                    ['name' => 'Farm Inputs', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Logistics',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Hauling & Freight', 'type' => 'EXPENSE'],
                    ['name' => 'Loading / Unloading', 'type' => 'EXPENSE'],
                    ['name' => 'Fuel', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Warehouse',
                'type' => 'EXPENSE',
                'children' => [
                    ['name' => 'Warehouse Rent', 'type' => 'EXPENSE'],
                    ['name' => 'Warehouse Labor', 'type' => 'EXPENSE'],
                    ['name' => 'Cold Storage', 'type' => 'EXPENSE'],
                    ['name' => 'Spoilage', 'type' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Member Equity',
                'type' => 'EQUITY',
                'children' => [
                    ['name' => 'Share Capital', 'type' => 'EQUITY'],
                    ['name' => 'Patronage Refunds', 'type' => 'EQUITY'],
                ],
            ],
        ],
    ],

    'banana_trading' => [
        'label' => 'Banana Trading / Supplier',
        'description' => 'Buy-and-sell banana trading: sales by variety, supplier purchases, delivery and logistics, operating costs.',
        'version' => 1,
        'tree' => [
            [
                'name' => 'Sales',
                'type' => 'REVENUE',
                'default_flow' => 'INCOME',
                'children' => [
                    ['name' => 'Banana Sales', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                    ['name' => 'Lakatan', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                    ['name' => 'Latundan', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                    ['name' => 'Saba', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                    ['name' => 'Cavendish', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                    ['name' => 'Other Varieties', 'type' => 'REVENUE', 'default_flow' => 'INCOME'],
                ],
            ],
            [
                'name' => 'Supplier Purchases',
                'type' => 'EXPENSE',
                'default_flow' => 'EXPENSE',
                'children' => [
                    ['name' => 'Banana Purchases', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Supplier Advances', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Packaging Materials', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Delivery & Logistics',
                'type' => 'EXPENSE',
                'default_flow' => 'EXPENSE',
                'children' => [
                    ['name' => 'Delivery Fee', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Hauling', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Fuel', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Loading / Unloading', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Toll Fees', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                ],
            ],
            [
                'name' => 'Operating Expenses',
                'type' => 'EXPENSE',
                'default_flow' => 'EXPENSE',
                'children' => [
                    ['name' => 'Labor / Arrastrador', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Spoilage & Losses', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Market Fees', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Communication', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                    ['name' => 'Miscellaneous', 'type' => 'EXPENSE', 'default_flow' => 'EXPENSE'],
                ],
            ],
        ],
    ],

];
