<?php
namespace TourOperatorProFrontend\app\helpers;

use TourOperatorPro\Factory;
use TourOperatorPro\Mvc\Model\Model as ModelAlias;
use TourOperatorPro\Utilities\Utility;

class SmsHelper extends FrontendHelper
{
    public static function get_sms_info_booking(){
        $db=Factory::getDBO();
        $query=$db->getQuery(true);
        $send_info_booking=static::get_sms_action_info_booking();
        $query->select("smscontent.*")
            ->from(Utility::getTableName('smscontent'). ' AS smscontent')
            ->leftJoin(Utility::getTableName('sms') .' AS sms ON sms.id=smscontent.sms_suplier_id')
            ->select('sms.account_id AS sms_account_id, sms.auth_token AS sms_auth_token, sms.phone_register AS sms_phone_register, sms.phonecode AS sms_phonecode, sms.countrycode AS sms_countrycode')
            ->where('sms.published=1')
            ->where('smscontent.action_sms='.$query->quote($send_info_booking))
        ;
        $sms=$db->setQuery($query)->loadObject();
        return $sms;

    }
    public static function get_sms_action_info_booking(){
        $appConfig = Factory::getAppConfig();
        $sms_actions = $appConfig->get('sms_action','');
        return "$sms_actions";
    }

}