<?php

abstract class ModelShippingCorreios{


  public static function getInstance($registry){
    $class  = null ;

    if($registry->get('config')->get('correios_api_status') === '1'){
      require_once(DIR_SYSTEM . 'library/shipping/correios_api.php');
      if(class_exists(ucfirst('ModelShippingCorreiosApi'))){
        $class = new ModelShippingCorreiosApi($registry);

      }else{
        throw new Exception("Falha ao instanciar o módulo de Correios API");
      }
    }else{
      require_once(DIR_SYSTEM . 'library/shipping/correios_sigep.php');
      if(class_exists(ucfirst('ModelShippingCorreiosSigep'))){
        $class = new ModelShippingCorreiosSigep($registry);

      }else{
        throw new Exception("Falha ao instanciar o módulo de Correios");
      }
    }

    return $class;

  }

}