<?php

namespace Hura8\Components\User\Model;

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


class UserModel extends aEntityBaseModel implements iEntityModel
{

    protected $web_user_id = '';
    protected $user_db_id = 0;

    public function __construct($web_user_id, $user_db_id = 0) {
        $this->web_user_id = $web_user_id;
        $this->user_db_id  = $user_db_id;

        parent::__construct('web_user_info');
    }


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


    protected function _buildQueryConditionExtend(array $condition) : ?array
    {
        /*$condition = array(
            "q" => "",
            "status" => 0,
        );*/

        /*$condition = array(
            "letter" => "",
        );*/

        $catCondition = [];
        $bind_types = [];
        $bind_values = [];


        if(isset($filter_condition["letter"]) && strlen($filter_condition["letter"]) == 1){
            $catCondition[] = " AND `letter` = ?  ";
            $bind_types[] = 's';
            $bind_values[] = $filter_condition["letter"];
        }

        return array( join(" ", $catCondition), $bind_types, $bind_values);
    }


}
