<?php
class HddMemoryUsageGauge extends AbstractGauge
{
    public function __construct($name, $model, $mountPoint) {

        $this->setModel($model);
        
        $this->setName($name);
        $this->setMin(0);
        $this->setMax($model->getMemoryMax($mountPoint));
        $this->setValueSuffix($model->getMemoryValueSuffix($mountPoint));
        $this->setSize(120);
        $this->setMinorTicks(5);
        
        $this->setGreenZones();
        $this->setYellowZones();
        $this->setRedZones();
    }
    
    public function setGreenZones($zones = array()) {
        if (empty($zones)) {
            $zones = array(
                array(
                    "from" => $this->max / 100 * 25,
                    "to" => $this->max / 100 * 70
                )
            );
        }
        return parent::setGreenZones($zones);
    }
    
    public function setYellowZones($zones = array()) {
        if (empty($zones)) {
            $zones = array(
                array(
                    "from" => $this->max / 100 * 60,
                    "to" => $this->max / 100 * 90
                )
            );
        }
        return parent::setYellowZones($zones);
    }
    
    public function setRedZones($zones = array()) {
        if (empty($zones)) {
            $zones = array(
                array(
                    "from" => $this->max / 100 * 90,
                    "to" => $this->max
                )
            );
        }
        return parent::setRedZones($zones);
    }
}