<?php

namespace Hura8\Components\User\Model;

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

class NewsletterModel extends aEntityBaseModel implements iEntityModel
{

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


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


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

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

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


    protected function beforeCreateItem(array $input_info) : AppResponse
    {
        $info = $input_info;

        $info['create_time'] = CURRENT_TIME;

        return new AppResponse('ok', null, $info);
    }

    protected function afterCreateItem($new_item_id, $new_item_info)
    {
        // TODO: Implement afterCreateItem() method.
    }

    protected function beforeUpdateItem($item_id, $current_item_info, $new_input_info) : AppResponse
    {
        return new AppResponse('ok', null, $new_input_info);
    }

    protected function afterUpdateItem($item_id, $old_item_info, $new_item_info)
    {
        // TODO: Implement afterUpdateItem() method.
    }

    protected function beforeDeleteItem($item_id, $item_info) : AppResponse
    {
        return new AppResponse('ok');
    }

    protected function afterDeleteItem($item_id, $item_info)
    {
        // TODO: Implement afterDeleteItem() method.
    }
}
