<?php
namespace Claromentis\People\Subscriber;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("_a889687d4f2" . "e7eed7a091dd" . "1abe903aa" => base64_decode("T25DcmVhdGVVc2V" . "y"), "_45ed8675ea7ead" . "a7f4efaaf62cef7" . "0c3" => base64_decode("T25VcGRhdG" . "VVc2Vy"), "_104d2e65fd6a1" . "2ea47809e77989" . "4b517" => base64_decode("T25EZ" . "WxldG" . "VVc2V" . "y"));
use Claromentis\Core\Event\EventSubscriberInterface;
use Claromentis\People\Event\AddUserEvent;
use Claromentis\People\Event\DeleteUserEvent;
use Claromentis\People\Event\PeopleEventType;
use Claromentis\People\Event\UpdateUserEvent;
use Claromentis\Search\Indexing\IndexingQueue;
use Claromentis\Search\ItemType\Indexing;




class SearchSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [PeopleEventType::ADD_USER => $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_a889687d4f2e7eed" . "7a091dd1abe903aa"], PeopleEventType::UPDATE_USER => $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_45ed8675ea7ea" . "da7f4efaaf62ce" . "f70c3"], PeopleEventType::DELETE_USER => $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_104d2e6" . "5fd6a12e" . "a47809e7" . "79894b51" . "7"]];
    }
    public function OnCreateUser(AddUserEvent $event)
    {
        $this->ReindexUser($event->GetUserId());
    }
    public function OnUpdateUser(UpdateUserEvent $event)
    {
        $this->ReindexUser($event->GetUserId());
    }
    public function OnDeleteUser(DeleteUserEvent $event)
    {
        $this->DeleteUserIndex($event->GetUserId());
    }
    protected function ReindexUser($user_id)
    {
        IndexingQueue::Reindex(Indexing\User::TYPE_NAME, $user_id);
    }
    protected function DeleteUserIndex($user_id)
    {
        IndexingQueue::DeleteIndex(Indexing\User::TYPE_NAME, $user_id);
    }
}