<?php

namespace App\Modules\Hr\Services;

use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class TimesheetExport extends BaseExport
{
    public function array(): array
    {
        return array_merge(
            $this->getHeaderRows(),
            $this->data,
            $this->getTotalRows()
        );
    }

    public function title(): string
    {
        return 'Times';
    }

    public function columnWidths(): array
    {
        return [
            'A' => 8,   // ID
            'B' => 15,  // Date  
            'C' => 20,  // Clocked In
            'D' => 20,  // Clocked Out
            'E' => 12,  // Hours
            'F' => 15,  // Total
        ];
    }

    public function styles(Worksheet $sheet)
    {
        $dataRowCount = count($this->data);
        $totalRows = $dataRowCount + 4; // Header rows + data + total rows
        
        // Apply all common styling from base class
        $this->applyHeaderStyling($sheet);
        $this->applyDataRowStyling($sheet, $dataRowCount);
        $this->applyTotalRowStyling($sheet, $totalRows);
        $this->applyNumberFormatting($sheet, $dataRowCount);
    }
} 