<?php
namespace TourOperatorProAdmin\app\helpers;

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

class EmailHelper extends AdminHelper
{

    public static function get_email_info_tour(){
        $db=Factory::getDBO();
        $query=$db->getQuery(true);
        $send_info_tour=static::get_email_key_info_tour();
        $query->select("*")
            ->from(Utility::getTableName('email'))
            ->where('type='.$query->quote($send_info_tour))
            ;
        $email=$db->setQuery($query)->loadObject();
        return $email;

    }
    public static function get_email_key_info_tour(){
        return "send_info_tour";
    }
    public static function get_list_email_type(){
        $list_email_type=array();
        $item=new \stdClass();
        $item->type="send_info_tour";
        $item->description="send info tour";
        $list_email_type[]=$item;
        $item=new \stdClass();
        $item->type="send_info_tour_config";
        $item->description="send info tour config";
        $list_email_type[]=$item;

        return $list_email_type;

    }

    public static function check_in_array_mail_type($type)
    {
        $list_type=self::get_list_email_type();
        foreach ($list_type as $item){
            if($item->type===$type){
                return true;
            }
        }
        return false;
    }

    public static function getDescriptionType($type="")
    {
        $list_type=self::get_list_email_type();
        foreach ($list_type as $item){
            if($item->type===$type){
                return $item->description;
            }
        }
        return "";
    }

}