<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithTitle;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

/**
 * Blank salary-table import template (header row + example rows).
 * Column headers must match the keys read by SalaryTableImport.
 */
class SalaryTemplateExport implements FromArray, ShouldAutoSize, WithHeadings, WithStyles, WithTitle
{
    public function title(): string
    {
        return 'Salary Table';
    }

    public function headings(): array
    {
        return ['Salary Structure', 'Grade', 'Step', 'Consolidated Amount', 'Effective From'];
    }

    public function array(): array
    {
        return [
            ['CONTEDISS', 'GL08', 3, 202576.50, '2025-01-01'],
            ['CONTEDISS', 'GL08', 4, 207821.33, '2025-01-01'],
            ['CONTEDISS', 'GL08', 5, 213065.92, '2025-01-01'],
        ];
    }

    public function styles(Worksheet $sheet): array
    {
        return [1 => ['font' => ['bold' => true]]];
    }
}
