<?php

namespace ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields;

/**
 * Number Field controler
 *
 * @author Sławomir Miśkowicz <slawomir@modulesgarden.com>
 */
class Range extends BaseField
{
    protected $id   = 'range';
    protected $name = 'range';
    protected $maxValue = null;
    protected $minValue = null;
    protected $outputVisible = true;

    public function __construct($id = null, $minValue = null, $maxValue = null)
    {
        parent::__construct($id);

        $this->minValue = $minValue;
        $this->maxValue = $maxValue;

    }

    public function getMinValue()
    {
        return $this->minValue;
    }

    public function getMaxValue()
    {
        return $this->maxValue;
    }

    /**
     * @param bool $visible
     */
    public function setOutputVisible($visible = true)
    {
        $this->outputVisible = $visible;
    }

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

    public function getOutputLabel(){
        if($this->getHtmlAttribute('data-label'.$this->getValue())){
            return $this->getHtmlAttribute('data-label'.$this->getValue());
        }
        return  $this->getValue();
    }
}
