<?php

namespace App\Service\DataGrid;

class DataGridHeader implements DataGridHeaderInterface
{
    public static $default_type = 'text';
    public static $default_label = 'Data Column';

    private $id;
    private $label;
    private $isSortable = false;
    private $type = '';

    public function __construct(array $params)
    {
        $this->id = $params['id'];
        $this->label = $params['label'] ?: static::$default_label;
        $this->type = isset($params['type']) ? $params['type'] : static::$default_type;
        $this->isSortable = isset($params['isSortable']) ? (bool) $params['isSortable'] : false;
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * @param mixed $label
     */
    public function setLabel($label)
    {
        $this->label = $label;

        return $this;
    }

    /**
     * @return bool
     */
    public function isSortable(): bool
    {
        return $this->isSortable;
    }

    /**
     * @param bool $isSortable
     */
    public function setIsSortable(bool $isSortable)
    {
        $this->isSortable = $isSortable;

        return $this;
    }

    /**
     * @return string
     */
    public function getType(): string
    {
        return $this->type;
    }

    /**
     * @param string $type
     */
    public function setType(string $type)
    {
        $this->type = $type;

        return $this;
    }
}
