<?php
namespace WpBookingHotelAdmin\app\helpers;

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

class EmailHelper extends AdminHelper
{

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

    }
    public static function get_email_key_info_hotel(){
        return "send_info_hotel";
    }
    public static function get_list_email_type(){
        $list_email_type=array();
        $item=new \stdClass();
        $item->type="send_info_hotel";
        $item->description="send info hotel";
        $list_email_type[]=$item;
        $item=new \stdClass();
        $item->type="send_info_hotel_config";
        $item->description="send info hotel 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 "";
    }

}