<?php

namespace App\Exports;

use App\Models\EventbriteUser;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
// use Maatwebsite\Excel\Excel;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class EventbriteUsersExport implements FromCollection, WithHeadings , WithStyles
{
    /**
     * @return \Illuminate\Support\Collection
     */
    public function collection()
    {
        return EventbriteUser::select('orderId', 'user_email', 'passport_id', 'quantity', 'order_date')->get();
    }

    public function headings(): array
    {
        return [
            'Order ID',
            'User Email',
            'Passport ID',
            'Quantity',
            'Order Date',
        ];
    }

    public function styles(Worksheet $sheet)
    {
        return [
            // Style the first row (headings)
            1 => ['font' => ['bold' => true]],
        ];
    }
}
