<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;

class StudentFormatExport implements FromArray, WithHeadings, ShouldAutoSize
{
    public function __construct(protected string $classroomTitle)
    {
    }

    public function headings(): array
    {
        return [
            'nisn',
            'name',
            'password',
            'gender',
            'classroom',
        ];
    }

    public function array(): array
    {
        return [
            [
                '1234567890',
                'Contoh Siswa',
                'password123',
                'L',
                $this->classroomTitle,
            ],
            [
                '1234567891',
                'Contoh Siswi',
                'password123',
                'P',
                $this->classroomTitle,
            ],
        ];
    }
}
