<?php
/**
 * Created by PhpStorm.
 * User: danielknudsen
 * Date: 10.01.19
 * Time: 09:14
 */

namespace App\Utils;


use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

class ExcelStyle
{
    const NUMBER_FORMAT_DECIMAL_STANDARD = NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1;
    const NUMBER_FORMAT_DECIMAL_ONE_DIGIT = '#,#0.0';
    const NUMBER_FORMAT_EURO = NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE;
    const NUMBER_FORMAT_METER = '#,##0.00_-"m"';
    const NUMBER_FORMAT_SQUARE_METER = '#,##0.00_-"m²"';
    const NUMBER_FORMAT_HOUR = '#,##0.00_-"Std"';
    const NUMBER_FORMAT_EMPLOYEE = '#,##0.00_-"MA"';
    const NUMBER_FORMAT_PIECES = '#,##0.00_-"Stück"';

    // Styles for cadaster excels
    public static $CADASTER_STYLES = [
        'alignment' => [
            'horizontal' => Alignment::HORIZONTAL_CENTER,
            'vertical'  => Alignment::VERTICAL_CENTER,
            'wrapText' => true
        ],
        'font' => [
            'size' => 11,
            'name' => 'Arial'
        ],
    ];

    // Font styles for cadaster excels
    public static $CADASTER_FONT = [
        'font' => [
            'size' => 11,
            'name' => 'Arial'
        ],
    ];

    // Bold style
    public static $FONT_BOLD = [
        'font' => [
            'bold' => true
        ],
    ];

    // Font align right
    public static $ALIGN_LEFT = [
        'alignment' => [
            'horizontal' => Alignment::HORIZONTAL_LEFT,
            'vertical' => Alignment::VERTICAL_CENTER,
            'wrapText' => true
        ]
    ];

    // Font align right
    public static $ALIGN_RIGHT = [
        'alignment' => [
            'horizontal' => Alignment::HORIZONTAL_RIGHT,
            'vertical' => Alignment::VERTICAL_CENTER,
            'wrapText' => true
        ]
    ];

    // Font align center
    public static $ALIGN_CENTER = [
        'alignment' => [
            'horizontal' => Alignment::HORIZONTAL_CENTER,
            'vertical' => Alignment::VERTICAL_CENTER,
            'wrapText' => true
        ]
    ];

    // Borders for cadaster excels
    public static $CADASTER_BORDERS = [
        'borders' => [
            'top' => [
                'borderStyle' => Border::BORDER_THIN,
                'color' => array('argb' => 'FF000000'),
            ],
            'bottom' => [
                'borderStyle' => Border::BORDER_THIN,
                'color' => array('argb' => 'FF000000'),
            ],
            'left' => [
                'borderStyle' => Border::BORDER_THIN,
                'color' => array('argb' => 'FF000000'),
            ],
            'right' => [
                'borderStyle' => Border::BORDER_THIN,
                'color' => array('argb' => 'FF000000'),
            ],
        ],
    ];

    // Medium borders for cadaster excels
    public static $CADASTER_BORDERS_MEDIUM = [
        'borders' => [
            'allBorders' => [
                'borderStyle' => Border::BORDER_THIN,
                'color' => array('argb' => 'FF000000'),
            ],
            'top' => [
                'borderStyle' => Border::BORDER_MEDIUM,
                'color' => array('argb' => 'FF000000'),
            ],
            'bottom' => [
                'borderStyle' => Border::BORDER_MEDIUM,
                'color' => array('argb' => 'FF000000'),
            ],
            'left' => [
                'borderStyle' => Border::BORDER_MEDIUM,
                'color' => array('argb' => 'FF000000'),
            ],
            'right' => [
                'borderStyle' => Border::BORDER_MEDIUM,
                'color' => array('argb' => 'FF000000'),
            ],
        ],
    ];

    // Dashed border
    public static $DASHED_BORDERS = [
        'borders' => [
            'bottom' => [
                'borderStyle' => Border::BORDER_MEDIUMDASHED,
                'color' => array('argb' => 'FF000000'),
            ]
        ],
    ];
}
