<?php
loadController('base/module');
class ControllerModuleGoogleCustomerAvalable extends ControllerBaseModule
{
  protected $referencePathFile = 'module/google_customer_avalable';

  protected $arrayJson = ['google_customer_avalable'];

  protected function loadModel()
  {
    parent::loadModel();
  }

  protected function loadData()
  {
    $this->load->dmodel('design/layout');
    parent::loadData();

    $this->dataVue['TypesForJs'] = array(
      Type_Gtin::getTypeForJs(),
      Type_Status::getTypeForJs(),
      Type_OptInStyle::getTypeForJs()
    );

    $this->dataVue['configurations'] = array(
      'google_merchant_center_status' => $this->config->get('google_merchant_center_status') ?? "0",
      'google_merchant_center_id' => $this->config->get('google_merchant_center_id'),
      'google_merchant_center_email' => $this->config->get('google_merchant_center_email'),
      'google_merchant_center_country' => $this->config->get('google_merchant_center_country'),
      'google_merchant_center_opt_in_style' => $this->config->get('google_merchant_center_opt_in_style') ?? "0",
    );

    $this->dataVue['layouts'] = $this->dmodel_design_layout->getLayouts();
  }

  public function save()
  {
    parent::save();
  }

  // TODO implements this 
  // private function validate()
  // {
    
  // }

  public function install()
  {
    $this->load->model('setting/extension');
    $this->model_setting_extension->install('module', 'google_customer_avalable');
  }

  public function uninstall()
  {
    $this->load->model('setting/extension');
    $this->model_setting_extension->uninstallSetting('module', 'google_customer_avalable');
  }
}