<?php
namespace Dreamfox\DeliveryDate\Premium\Facades;


class SystemFacade
{

  private static $_instance = null;
  private $_commonSettingFacade;
  private $_categorySettingFacade;
  private $_holidaySettingFacade;
  private $_otherSettingFacade;

  public function __construct()
  {
    $this->_commonSettingFacade = new CommonSettingFacade();
    $this->_categorySettingFacade = new CategorySettingFacade();
    $this->_holidaySettingFacade = new HolidaySettingFacade();
    $this->_otherSettingFacade = new OtherSettingFacade();
  }

  public static function getInstance() {
    if (self::$_instance == null) {
      self::$_instance = new self();
    }
    return self::$_instance;
  }

  #begin_region common settings
    public function loadCommonSettings()
    {
      return $this->_commonSettingFacade->load();
    }

    public function saveCommonSettings($data)
    {
      $this->_commonSettingFacade->save($data);
    }
  #end_region

  #begin_region category settings
    public function loadCategorySettings()
    {
      return $this->_categorySettingFacade->load();
    }

    public function saveCategorySettings($data)
    {
      $this->_categorySettingFacade->save($data);
    }
  #end_region

  #begin_region holiday settings
    public function loadHolidaySettings()
    {
      return $this->_holidaySettingFacade->load();
    }

    public function saveHolidaySettings($data)
    {
      $this->_holidaySettingFacade->save($data);
    }
  #end_region

  #begin_region other settings
    public function loadOtherSettings()
    {
      return $this->_otherSettingFacade->load();
    }

    public function saveOtherSettings($data)
    {
      $this->_otherSettingFacade->save($data);
    }
  #end_region

  public function loadCategories()
  {
    return \Dreamfox\DeliveryDate\Facades\SystemFacade::getInstance()->loadCategories();
  }
}