<?php


namespace Hura8\Components\Template\Model;

use Hura8\Interfaces\AppResponse;
use Hura8\System\Model\aEntityBaseModel;

class TemplateSetModel extends aEntityBaseModel
{

    protected $tb_template = 'tb_template';

    public function __construct()
    {
        parent::__construct('template_set');
    }


    protected function extendedFilterOptions() : array
    {
        return [
            // empty for now
        ];
    }


    public function getInfoBySet($set_name)
    {
        $query = $this->db->runQuery("SELECT * FROM `". $this->tb_entity ."`  WHERE `folder_name` = ? LIMIT 1 ", ['s'], [$set_name]);
        if($item_info = $this->db->fetchAssoc($query)){
            return $item_info;
        }

        return false;
    }


    public function getActivatedSet() {
        $query = $this->db->runQuery("SELECT `folder_name` FROM `". $this->tb_entity ."`  WHERE `is_activated` = 1 LIMIT 1 ");
        if($item_info = $this->db->fetchAssoc($query)){
            return $item_info['folder_name'];
        }

        return 'default';
    }


    protected function _buildQueryConditionExtend(array $condition) : ?array
    {
        $where_clause = "";
        $bind_types = [];
        $bind_values = [];

        return [
            $where_clause,
            $bind_types,
            $bind_values
        ];
    }



}
