<?php

namespace Database\Seeders;

use App\Models\User;
use App\Models\Subscriber;
use App\Models\Lead;
use App\Models\Ticket;
use App\Models\IspPlan;
use App\Models\Router;
use App\Models\NetworkSession;
use App\Models\Voucher;
use App\Models\VoucherAgent;
use App\Models\FiberNode;
use App\Models\SmsCampaign;
use App\Models\Expense;
use App\Models\Client;
use App\Models\Invoice;
use App\Models\InvoiceItem;
use App\Models\PaymentTransaction;
use App\Models\SubscriptionPlan;
use App\Models\Subscription;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Carbon\Carbon;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // 1. Admin Account
        User::updateOrCreate(
            ['email' => 'bhattc02@gmail.com'],
            [
                'name' => 'Chandra Admin',
                'password' => Hash::make('1234567890'),
                'email_verified_at' => now(),
            ]
        );

        // 2. ISP Internet Plans
        $plansData = [
            ['name' => 'Home 10 Mbps', 'type' => 'PPPoE', 'availability' => 'Live', 'price' => 500.00, 'duration' => '30 Days', 'download_speed' => '10 Mbps', 'upload_speed' => '5 Mbps'],
            ['name' => 'Fiber Pro 25 Mbps', 'type' => 'PPPoE', 'availability' => 'Live', 'price' => 999.00, 'duration' => '30 Days', 'download_speed' => '25 Mbps', 'upload_speed' => '15 Mbps'],
            ['name' => 'Enterprise 50 Mbps', 'type' => 'PPPoE', 'availability' => 'Live', 'price' => 1999.00, 'duration' => '30 Days', 'download_speed' => '50 Mbps', 'upload_speed' => '50 Mbps'],
            ['name' => 'Hotspot 1 Hour Pass', 'type' => 'Hotspot', 'availability' => 'Live', 'price' => 20.00, 'duration' => '1 Hour', 'download_speed' => '5 Mbps', 'upload_speed' => '2 Mbps'],
            ['name' => 'Hotspot 1 Day Pass', 'type' => 'Hotspot', 'availability' => 'Live', 'price' => 50.00, 'duration' => '1 Day', 'download_speed' => '5 Mbps', 'upload_speed' => '2 Mbps'],
            ['name' => 'Hotspot 7 Days Pass', 'type' => 'Hotspot', 'availability' => 'Live', 'price' => 250.00, 'duration' => '7 Days', 'download_speed' => '10 Mbps', 'upload_speed' => '5 Mbps'],
            ['name' => 'Legacy 2 Mbps Binding', 'type' => 'Binding', 'availability' => 'Hidden', 'price' => 350.00, 'duration' => '30 Days', 'download_speed' => '2 Mbps', 'upload_speed' => '1 Mbps'],
        ];

        foreach ($plansData as $p) {
            IspPlan::create($p);
        }

        // 3. MikroTik Routers
        $routersData = [
            ['name' => 'Core-CCR1036-Main', 'ip_address' => '192.168.88.1', 'model' => 'CCR1036-12G-4S', 'os_version' => 'v7.12.1', 'location' => 'Central POP', 'status' => 'Online', 'cpu_usage' => 14, 'active_sessions' => 84],
            ['name' => 'North-RB3011-Hotspot', 'ip_address' => '192.168.89.1', 'model' => 'RB3011UiAS-RM', 'os_version' => 'v7.10.2', 'location' => 'North Sector', 'status' => 'Online', 'cpu_usage' => 28, 'active_sessions' => 32],
            ['name' => 'East-CCR2004-Fiber', 'ip_address' => '192.168.90.1', 'model' => 'CCR2004-16G-2S+', 'os_version' => 'v7.13.0', 'location' => 'East Tower POP', 'status' => 'Online', 'cpu_usage' => 9, 'active_sessions' => 112],
            ['name' => 'West-RB4011-Backup', 'ip_address' => '192.168.91.1', 'model' => 'RB4011iGS+RM', 'os_version' => 'v7.11.0', 'location' => 'West Link', 'status' => 'Online', 'cpu_usage' => 18, 'active_sessions' => 45],
        ];

        $createdRouters = [];
        foreach ($routersData as $r) {
            $createdRouters[] = Router::create($r);
        }

        // 4. Subscribers (25 realistic entries across PPPoE, Hotspot, Binding)
        $names = [
            ['name' => 'Chandra Bhatt', 'type' => 'PPPoE', 'plan' => 'Fiber Pro 25 Mbps', 'price' => 999.00],
            ['name' => 'Alex Rivera', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Sophia Vance', 'type' => 'PPPoE', 'plan' => 'Enterprise 50 Mbps', 'price' => 1999.00],
            ['name' => 'Liam Gallagher', 'type' => 'Hotspot', 'plan' => 'Hotspot 7 Days Pass', 'price' => 250.00],
            ['name' => 'Emma Watson', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Marcus Chen', 'type' => 'Hotspot', 'plan' => 'Hotspot 1 Day Pass', 'price' => 50.00],
            ['name' => 'Olivia Martinez', 'type' => 'PPPoE', 'plan' => 'Fiber Pro 25 Mbps', 'price' => 999.00],
            ['name' => 'Daniel Kim', 'type' => 'Binding', 'plan' => 'Legacy 2 Mbps Binding', 'price' => 350.00],
            ['name' => 'Isabella Rossi', 'type' => 'PPPoE', 'plan' => 'Enterprise 50 Mbps', 'price' => 1999.00],
            ['name' => 'Ethan Thorne', 'type' => 'Hotspot', 'plan' => 'Hotspot 7 Days Pass', 'price' => 250.00],
            ['name' => 'Chloe Bennett', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Noah Jenkins', 'type' => 'PPPoE', 'plan' => 'Fiber Pro 25 Mbps', 'price' => 999.00],
            ['name' => 'Ava Reynolds', 'type' => 'Binding', 'plan' => 'Legacy 2 Mbps Binding', 'price' => 350.00],
            ['name' => 'James Sterling', 'type' => 'PPPoE', 'plan' => 'Enterprise 50 Mbps', 'price' => 1999.00],
            ['name' => 'Mia Takahashi', 'type' => 'Hotspot', 'plan' => 'Hotspot 1 Hour Pass', 'price' => 20.00],
            ['name' => 'Lucas Wright', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Charlotte Hayes', 'type' => 'PPPoE', 'plan' => 'Fiber Pro 25 Mbps', 'price' => 999.00],
            ['name' => 'Benjamin Foster', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Amelia Brooks', 'type' => 'Hotspot', 'plan' => 'Hotspot 1 Day Pass', 'price' => 50.00],
            ['name' => 'Henry Dupont', 'type' => 'Binding', 'plan' => 'Legacy 2 Mbps Binding', 'price' => 350.00],
            ['name' => 'Harper Miller', 'type' => 'PPPoE', 'plan' => 'Fiber Pro 25 Mbps', 'price' => 999.00],
            ['name' => 'Mason Cooper', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
            ['name' => 'Evelyn Reed', 'type' => 'Hotspot', 'plan' => 'Hotspot 7 Days Pass', 'price' => 250.00],
            ['name' => 'Logan Ward', 'type' => 'PPPoE', 'plan' => 'Enterprise 50 Mbps', 'price' => 1999.00],
            ['name' => 'Abigail Bailey', 'type' => 'PPPoE', 'plan' => 'Home 10 Mbps', 'price' => 500.00],
        ];

        $statuses = ['Active', 'Active', 'Active', 'Active', 'Expiring', 'At Risk'];
        $createdSubscribers = [];

        foreach ($names as $idx => $n) {
            $status = $statuses[$idx % count($statuses)];
            $sub = Subscriber::create([
                'name' => $n['name'],
                'email' => Str::slug($n['name']) . '@example.com',
                'phone' => '+91 ' . rand(7000000000, 9999999999),
                'type' => $n['type'],
                'status' => $status,
                'username' => Str::slug($n['name']) . '_user',
                'password' => 'secret123',
                'mac_address' => sprintf('%02X:%02X:%02X:%02X:%02X:%02X', rand(0,255), rand(0,255), rand(0,255), rand(0,255), rand(0,255), rand(0,255)),
                'ip_address' => '10.100.' . rand(1, 10) . '.' . rand(2, 250),
                'nas_router' => $createdRouters[$idx % count($createdRouters)]->name,
                'plan_name' => $n['plan'],
                'plan_price' => $n['price'],
                'expiry_date' => Carbon::now()->addDays(rand(-5, 25)),
                'last_online' => Carbon::now()->subMinutes(rand(2, 5000)),
                'balance' => 0.00,
                'address' => 'Sector ' . rand(1, 22) . ', Sector Hub, City',
            ]);
            $createdSubscribers[] = $sub;

            // Also create a Client record for backwards billing compatibility
            $client = Client::create([
                'name' => $sub->name,
                'company' => $sub->name . ' Account',
                'email' => $sub->email,
                'phone' => $sub->phone,
                'address' => $sub->address,
                'status' => $sub->status === 'At Risk' ? 'Overdue' : 'Active',
                'total_billed' => $sub->plan_price * 3,
                'total_paid' => $sub->plan_price * 2,
            ]);

            // Create Invoice
            $invNum = 'INV-2026-' . str_pad($idx + 1, 4, '0', STR_PAD_LEFT);
            $invStatus = ($idx % 3 == 0) ? 'Paid' : (($idx % 4 == 0) ? 'Overdue' : 'Unpaid');
            $inv = Invoice::create([
                'invoice_number' => $invNum,
                'client_id' => $client->id,
                'issue_date' => now()->subDays(rand(2, 30)),
                'due_date' => now()->addDays(rand(1, 15)),
                'subtotal' => $sub->plan_price,
                'tax_percent' => 10.00,
                'tax_amount' => round($sub->plan_price * 0.10, 2),
                'discount_amount' => 0.00,
                'total_amount' => round($sub->plan_price * 1.10, 2),
                'status' => $invStatus,
                'notes' => 'Monthly Internet Broadband Service Package Renewal.',
            ]);

            InvoiceItem::create([
                'invoice_id' => $inv->id,
                'description' => $sub->plan_name . ' Broadband Plan',
                'quantity' => 1,
                'unit_price' => $sub->plan_price,
                'total' => $sub->plan_price,
            ]);

            if ($invStatus === 'Paid') {
                PaymentTransaction::create([
                    'transaction_reference' => 'TXN-' . Str::upper(Str::random(10)),
                    'invoice_id' => $inv->id,
                    'client_id' => $client->id,
                    'amount' => $inv->total_amount,
                    'payment_method' => rand(0, 1) ? 'Stripe' : 'UPI / Bank',
                    'status' => 'Success',
                    'paid_at' => now()->subDays(rand(1, 10)),
                ]);
            }

            // Create active sessions for online users
            if ($idx < 15) {
                NetworkSession::create([
                    'subscriber_id' => $sub->id,
                    'username' => $sub->username,
                    'type' => $sub->type,
                    'router_id' => $createdRouters[$idx % count($createdRouters)]->id,
                    'ip_address' => $sub->ip_address,
                    'mac_address' => $sub->mac_address,
                    'upload_bytes' => rand(1048576, 5368709120),
                    'download_bytes' => rand(10485760, 53687091200),
                    'duration_seconds' => rand(300, 86400),
                    'status' => 'Active',
                    'started_at' => now()->subHours(rand(1, 24)),
                ]);
            }
        }

        // 5. Sales Leads (Kanban Board)
        $leads = [
            ['name' => 'Metro Residency Apartments', 'phone' => '+91 9876543210', 'email' => 'contact@metroresidency.org', 'area' => 'Sector 45', 'source' => 'Walk-in', 'plan' => 'Enterprise 50 Mbps', 'mrr' => 1999.00, 'status' => 'New'],
            ['name' => 'Vanguard Cyber Cafe', 'phone' => '+91 9876543211', 'email' => 'info@vanguardcyber.com', 'area' => 'Tech Park Zone 2', 'source' => 'Website', 'plan' => 'Enterprise 50 Mbps', 'mrr' => 1999.00, 'status' => 'New'],
            ['name' => 'Dr. Rajiv Malhotra', 'phone' => '+91 9876543212', 'email' => 'rajiv@healthclinic.in', 'area' => 'Green Park', 'source' => 'Referral', 'plan' => 'Fiber Pro 25 Mbps', 'mrr' => 999.00, 'status' => 'Contacted'],
            ['name' => 'Pinnacle Co-Working Space', 'phone' => '+91 9876543213', 'email' => 'ops@pinnaclespace.co', 'area' => 'Financial District', 'source' => 'Sales Agent', 'plan' => 'Enterprise 50 Mbps', 'mrr' => 1999.00, 'status' => 'Contacted'],
            ['name' => 'Sunlight Multi-Speciality Clinic', 'phone' => '+91 9876543214', 'email' => 'admin@sunlightmed.com', 'area' => 'Civil Lines', 'source' => 'Phone', 'plan' => 'Fiber Pro 25 Mbps', 'mrr' => 999.00, 'status' => 'Qualified'],
            ['name' => 'Oakwood International School', 'phone' => '+91 9876543215', 'email' => 'it@oakwoodschool.edu', 'area' => 'Academic Campus', 'source' => 'Tender', 'plan' => 'Enterprise 50 Mbps', 'mrr' => 3998.00, 'status' => 'Site survey'],
            ['name' => 'Grand Plaza Hotel', 'phone' => '+91 9876543216', 'email' => 'gm@grandplazahotel.in', 'area' => 'Airport Road', 'source' => 'Website', 'plan' => 'Hotspot 30 Days', 'mrr' => 4999.00, 'status' => 'Site survey'],
            ['name' => 'Apex Financial Advisory', 'phone' => '+91 9876543217', 'email' => 'support@apexfin.com', 'area' => 'CBD Tower', 'source' => 'Sales Agent', 'plan' => 'Fiber Pro 25 Mbps', 'mrr' => 999.00, 'status' => 'Converted'],
        ];

        foreach ($leads as $l) {
            Lead::create([
                'name' => $l['name'],
                'phone' => $l['phone'],
                'email' => $l['email'],
                'area' => $l['area'],
                'source' => $l['source'],
                'plan_interested' => $l['plan'],
                'mrr_projected' => $l['mrr'],
                'status' => $l['status'],
                'assigned_staff' => 'Rohan Sales Manager',
                'followup_date' => now()->addDays(rand(1, 5)),
            ]);
        }

        // 6. Support Tickets
        $tickets = [
            ['num' => 'TCK-00101', 'subject' => 'No internet connectivity since morning', 'desc' => 'LOS red light blinking on fiber ONT modem box.', 'status' => 'Open', 'priority' => 'Critical', 'sub' => $createdSubscribers[0]],
            ['num' => 'TCK-00102', 'subject' => 'Frequent latency spikes during video conference', 'desc' => 'Ping jumps to 300ms on server 10.100.1.5.', 'status' => 'In Progress', 'priority' => 'High', 'sub' => $createdSubscribers[1]],
            ['num' => 'TCK-00103', 'subject' => 'Request for static IP assignment', 'desc' => 'Customer needs static IP for CCTV NVR portal.', 'status' => 'Open', 'priority' => 'Normal', 'sub' => $createdSubscribers[2]],
            ['num' => 'TCK-00104', 'subject' => 'Hotspot login page redirection loop', 'desc' => 'Voucher code inputs throw timeout.', 'status' => 'Urgent', 'priority' => 'High', 'sub' => $createdSubscribers[3]],
            ['num' => 'TCK-00105', 'subject' => 'Plan upgrade from 10 Mbps to 25 Mbps', 'desc' => 'Customer paid online via UPI.', 'status' => 'Resolved', 'priority' => 'Normal', 'sub' => $createdSubscribers[4]],
            ['num' => 'TCK-00106', 'subject' => 'Fiber cable damage due to tree trimming', 'desc' => 'Drop wire broken at pole #42.', 'status' => 'In Progress', 'priority' => 'Critical', 'sub' => $createdSubscribers[5]],
        ];

        foreach ($tickets as $t) {
            Ticket::create([
                'ticket_number' => $t['num'],
                'subscriber_id' => $t['sub']->id,
                'subscriber_name' => $t['sub']->name,
                'subject' => $t['subject'],
                'description' => $t['desc'],
                'assignee' => 'Sanjay Network Technician',
                'status' => $t['status'],
                'priority' => $t['priority'],
                'notify_create' => true,
                'notify_resolve' => true,
            ]);
        }

        // 7. Vouchers & Voucher Agents
        $agentsData = [
            ['name' => 'Rajesh Mobile Store', 'email' => 'rajesh@mobilestore.in', 'phone' => '+91 9988776655', 'opening_float' => 5000.00, 'current_float' => 3450.00, 'assigned' => 100, 'sold' => 31],
            ['name' => 'Stationery World Cafe', 'email' => 'contact@stationeryworld.co', 'phone' => '+91 9988776644', 'opening_float' => 3000.00, 'current_float' => 1800.00, 'assigned' => 60, 'sold' => 24],
            ['name' => 'Metro Bus Stand Kiosk', 'email' => 'kiosk@metrobus.org', 'phone' => '+91 9988776633', 'opening_float' => 2000.00, 'current_float' => 950.00, 'assigned' => 40, 'sold' => 21],
        ];

        foreach ($agentsData as $ag) {
            VoucherAgent::create([
                'name' => $ag['name'],
                'email' => $ag['email'],
                'phone' => $ag['phone'],
                'opening_float' => $ag['opening_float'],
                'current_float' => $ag['current_float'],
                'assigned_vouchers_count' => $ag['assigned'],
                'sold_vouchers_count' => $ag['sold'],
                'commission_rate' => 10.00,
                'status' => 'Active',
            ]);
        }

        for ($v = 1; $v <= 40; $v++) {
            Voucher::create([
                'batch_code' => 'BATCH-HOTSPOT-0' . ($v > 20 ? '2' : '1'),
                'voucher_code' => 'WIFI-' . Str::upper(Str::random(8)),
                'package_name' => ($v % 2 == 0) ? 'Hotspot 1 Day Pass' : 'Hotspot 7 Days Pass',
                'price' => ($v % 2 == 0) ? 50.00 : 250.00,
                'status' => ($v % 3 == 0) ? 'Redeemed' : 'Unused',
                'assigned_agent' => 'Rajesh Mobile Store',
                'redeemed_at' => ($v % 3 == 0) ? now()->subHours(rand(1, 48)) : null,
            ]);
        }

        // 8. Fiber GIS Nodes
        $fiberNodes = [
            ['name' => 'Central POP Station', 'type' => 'POP', 'lat' => 28.6139, 'lng' => 77.2090, 'capacity' => '10 Gbps Fiber Core'],
            ['name' => 'Main OLT Tower #1', 'type' => 'OLT', 'lat' => 28.6180, 'lng' => 77.2150, 'capacity' => '16 PON Ports OLT'],
            ['name' => 'Sector 14 Fiber Closure', 'type' => 'Closure', 'lat' => 28.6220, 'lng' => 77.2200, 'capacity' => '48 Core Joint Box'],
            ['name' => 'Primary Splitter 1:16 #A', 'type' => 'Splitter', 'lat' => 28.6250, 'lng' => 77.2230, 'capacity' => '1:16 PLC Splitter'],
            ['name' => 'ODB Box Sector 14-B', 'type' => 'ODB', 'lat' => 28.6280, 'lng' => 77.2260, 'capacity' => '24 Port Distribution Box'],
            ['name' => 'Customer Drop - Alex Rivera', 'type' => 'Drop', 'lat' => 28.6300, 'lng' => 77.2280, 'capacity' => 'Single Core Drop Cable'],
        ];

        foreach ($fiberNodes as $fn) {
            FiberNode::create([
                'name' => $fn['name'],
                'type' => $fn['type'],
                'lat' => $fn['lat'],
                'lng' => $fn['lng'],
                'capacity' => $fn['capacity'],
                'status' => 'Active',
            ]);
        }

        // 9. Operating Expenses
        $expenses = [
            ['category' => 'Bandwidth', 'description' => 'Upstream Bandwidth 1 Gbps Fiber Lease', 'amount' => 45000.00, 'vendor' => 'Airtel Enterprise Gateway', 'date' => now()->subDays(5)],
            ['category' => 'Electricity', 'description' => 'POP Station Power & UPS Backup Utility', 'amount' => 12500.00, 'vendor' => 'State Electricity Board', 'date' => now()->subDays(10)],
            ['category' => 'Rent', 'description' => 'Central POP Building & Tower Rent', 'amount' => 25000.00, 'vendor' => 'Metro Properties', 'date' => now()->subDays(15)],
            ['category' => 'Salary', 'description' => 'Monthly Staff Payroll - Support & Technicians', 'amount' => 85000.00, 'vendor' => 'Bank Payroll Direct', 'date' => now()->subDays(20)],
            ['category' => 'Equipment', 'description' => 'Purchase of 50 ONU Optical Modems & Fiber Drop Cables', 'amount' => 32000.00, 'vendor' => 'OptiTech Systems', 'date' => now()->subDays(22)],
        ];

        foreach ($expenses as $ex) {
            Expense::create([
                'category' => $ex['category'],
                'description' => $ex['description'],
                'amount' => $ex['amount'],
                'vendor' => $ex['vendor'],
                'expense_date' => $ex['date'],
                'payment_method' => 'Bank Transfer',
            ]);
        }

        // 10. SMS Campaigns
        SmsCampaign::create([
            'name' => 'Monthly Expiry Reminder Campaign',
            'message_body' => 'Dear @first_name, your @package_name Broadband plan expires on @expiry_date. Recharge today to stay connected.',
            'recipients_count' => 18,
            'segments_count' => 1,
            'channel' => 'SMS',
            'status' => 'Completed',
            'sent_at' => now()->subDays(2),
        ]);

        SmsCampaign::create([
            'name' => 'Monsoon Festival Discount Offer',
            'message_body' => 'Upgrade to Fiber Pro 25 Mbps and get 15 days extra validity free! Call support to activate.',
            'recipients_count' => 45,
            'segments_count' => 1,
            'channel' => 'WhatsApp',
            'status' => 'Completed',
            'sent_at' => now()->subDays(8),
        ]);

        // 11. SaaS Subscription Plans & Subscriptions
        $subPlans = [
            [
                'name' => 'Starter CRM Tier',
                'slug' => 'starter-crm-tier',
                'price' => 1499.00,
                'billing_cycle' => 'Monthly',
                'description' => 'Ideal for small local ISPs managing up to 100 subscribers.',
                'features' => ['Up to 100 Subscribers', 'Basic Billing & Invoicing', 'Email Support'],
                'is_active' => true,
            ],
            [
                'name' => 'Professional ISP Tier',
                'slug' => 'professional-isp-tier',
                'price' => 3999.00,
                'billing_cycle' => 'Monthly',
                'description' => 'For growing broadband providers with MikroTik NAS integration.',
                'features' => ['Up to 1,000 Subscribers', 'MikroTik API Integration', 'Voucher & Hotspot Management', 'Priority Support'],
                'is_active' => true,
            ],
            [
                'name' => 'Enterprise Operator Tier',
                'slug' => 'enterprise-operator-tier',
                'price' => 9999.00,
                'billing_cycle' => 'Monthly',
                'description' => 'Unlimited capacity, Fiber GIS mapping, and SMS automation.',
                'features' => ['Unlimited Subscribers', 'Fiber GIS Mapping', 'SMS & WhatsApp Marketing', 'Dedicated Account Manager'],
                'is_active' => true,
            ],
        ];

        $createdSubPlans = [];
        foreach ($subPlans as $sp) {
            $createdSubPlans[] = SubscriptionPlan::create($sp);
        }

        $allClients = Client::all();
        foreach ($allClients as $idx => $cli) {
            Subscription::create([
                'client_id' => $cli->id,
                'subscription_plan_id' => $createdSubPlans[$idx % count($createdSubPlans)]->id,
                'status' => ($idx % 5 == 0) ? 'Paused' : 'Active',
                'starts_at' => now()->subMonths(rand(1, 6)),
                'renews_at' => now()->addDays(rand(5, 30)),
                'auto_renew' => true,
            ]);
        }
    }
}
