<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class ClientsImportSampleFile implements FromCollection, WithHeadings
{
    /**
     * @return \Illuminate\Support\Collection
     */
    public function collection()
    {
        $data = [
            [
                'user1',
                '1234',
                'demo',
                '01700000000',
                '10mb',
                'reseller1',
                'zone1',
                '13',
                'demo@demo.com',
                'F Name',
                'M Name',
                'Area',
                'Mikrotik Comment',
                '24-12-2022',
                'cat6',
                '24-12-2024',
                '1234',
            ]

        ];

        return collect($data);
    }

    public function headings(): array
    {
        $headings = [
            'ppoe user*',
            'ppoe password*',
            'Name*',
            'Phone No',
            'Packege Name*',
            'Reseller Name',
            'Zone/Pop*',
            'Billing Cycle*',
            'Email',
            'Father\'s Name',
            'Mother\'s Name',
            'Area',
            'Mikrotik Comment',
            'Joining Date',
            'Cable Type',
            'expire date',
            'customer code',
            'Division',
            'District',
            'Upazila',
            // Add more headings as needed
        ];

        // Conditionally modify last 3 fields
        if (checkSettings('import_excel_requred') == 'enable') {
            $headings[17] = 'Division*';
            $headings[18] = 'District*';
            $headings[19] = 'Upazila*';
        }

        return $headings;
        // return [
        //     'ppoe user*',
        //     'ppoe password*',
        //     'Name*',
        //     'Phone No',
        //     'Packege Name*',
        //     'Reseller Name',
        //     'Zone/Pop*',
        //     'Billing Cycle*',
        //     'Email',
        //     'Father\'s Name',
        //     'Mother\'s Name',
        //     'Area',
        //     'Mikrotik Comment',
        //     'Joining Date',
        //     'Cable Type',
        //     'expire date',
        //     'customer code',
        //     'Division',
        //     'District',
        //     'Upazila',
        //     // Add more headings as needed
        // ];
    }
}
