<?php
abstract class AbstractGauge
{
    protected $model = null; 
    protected $name;
    protected $label;
    protected $min;
    protected $max;
    protected $size = 120;
    protected $minorTicks = 5;
    protected $greenZones;
    protected $yellowZones;
    protected $redZones;
    protected $valueSuffix;
    
    public function setModel($model = null) {
        $this->model = $model;
        if (!$this->model) {
            $this->model = new SystemOverview();
        } 
    }
    
    public function getModel() {
        return $this->model;
    }
    
    public function setName($name) {
        $this->name = $name;
    }
    
    public function getName() {
        return $this->name;
    }
    
    public function setLabel($label = null) {
        $this->label = $label;
    }
    
    public function getLabel() {
        return $this->label;
    }
    
    public function setMin($min) {
        $this->min = (int) $min;
    }
    
    public function getMin() {
        return $this->min;
    }

    public function setMax($max) {
        $this->max = $max;
    }
    
    public function getMax() {
        return $this->max;
    }
     
    public function setSize($size) {
        $this->size = (int) $size;
    }
    
    public function getSize() {
        return $this->size;
    }
    
    public function setMinorTicks($minorTicks) {
        $this->minorTicks = (int) $minorTicks;
    }
    
    public function getMinorTicks() {
        return $this->minorTicks;
    }
    
    public function setGreenZones($greenZones = array()) {
        $this->greenZones = json_encode($greenZones);
    }
    
    public function getGreenZones() {
        return $this->greenZones;
    }
    
    public function setYellowZones($yellowZones) {
        $this->yellowZones = json_encode($yellowZones);
    }
        
    public function getYellowZones() {
        return $this->yellowZones;
    }
    
    public function setRedZones($redZones) {
        $this->redZones = json_encode($redZones);
    }
    
    public function getRedZones() {
        return $this->redZones;
    }
    
    public function setValueSuffix($valueSuffix) {
        $this->valueSuffix = $valueSuffix;
    }
    
    public function getValueSuffix() {
        return $this->valueSuffix;
    }

    public function getGaugeOptions() {
        return array(
            "name" => $this->getName(),
            "config" => array(
                "label" => $this->getLabel(),
                "min" => $this->getMin(),
                "max" => $this->getMax(),
                "size" =>  $this->getSize(),
                "minorTicks" => $this->getMinorTicks(),
                "greenZones" => $this->getGreenZones(),
                "yellowZones" => $this->getYellowZones(),
                "redZones" => $this->getRedZones(),
                "valueSuffix" => $this->getValueSuffix()
        ));
    }
}