<?php
loadcontroller('base/module');

class ControllerShippingKangu extends ControllerBaseModule{

    protected $referencePathFile = 'shipping/kangu';

    protected $fieldsToRemoveMask = [];

    protected function loadData()
    {
        $this->load->model('setting/setting');
        $this->load->model('localisation/geo_zone');
        $this->load->model('localisation/zone');

        $this->load->type('tipocomum');
        $this->load->type('tipofrete');
        $country_id = Type_PaisId::Tp_Brasil;

        $this->dataVue['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
        $this->dataVue['zones'] = $this->model_localisation_zone->getZonesByCountryId($country_id);

        $this->dataVue['Type_Status'] = Type_Status::getEnumList();
        $this->dataVue['Type_Environment'] = Type_Environment::getEnumList();
        $this->dataVue['Type_sort_order'] = Type_sort_order::getEnumList();
        $this->dataVue['Type_DsimDnao'] = Type_DsimDnao::getEnumList();

        $this->dataVue['configurations'] = $this->model_setting_setting->getSetting('kangu');

        //Manual Atualizar quando precisar
        //$this->dataVue['help_link'] = 'http://manual.futurasistemas.com.br/manual-do-sistema/como-realizar-a-integracao-com-o-melhor-envio-faq95/';

        //$this->setDefaultValues();
    }
    protected function validate()
    {
        $this->loadLanguage();
        $this->load->type('tipocomum');

    }

        public function install()
    {
        $this->load->model('setting/setting');

        $kanguAuthInfo = [
            'kangu_client_id' => Kangu::clientIdFutura,
            'kangu_client_secret' => Kangu::clientSecretFutura
        ];

        $this->model_setting_setting->editSetting('kangu', $kanguAuthInfo);
    }

}

?>