<?php

namespace App\Repositories\Core\Export;

class HelperExcel
{
    public static function getHeaderStyle($color = 'ffffff', $bgcolor = '00a3cb')
    {
        return [
            'fill' => self::setFill($bgcolor),
            'borders' => self::setBorders($bgcolor),
            'font' => self::setFont($color, 14, true),
        ];
    }

    public static function setFill($color)
    {
        return [
            'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
            'startColor' => [
                'rgb' => $color,
            ],
        ];
    }

    public static function setBorders($color)
    {
        return [
            'outline' => [
                'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
                'color' => ['argb' => $color],
            ],
        ];
    }

    public static function setFont($color, $size = 12, $bold = false, $font = 'Calibri')
    {
        return [
            'name' => $font,
            'size' => $size,
            'bold' => $bold,
            'color' => ['argb' => $color],
        ];
    }
}
