<?php
namespace Claromentis\People\Subscriber;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] ?: array()) + array("_a889687d4f2e7eed7a091dd1abe90" . "3aa" => base64_decode("T25D" . "cmVh" . "dGVV" . "c2Vy"), "_104d2e65" . "fd6a12ea4" . "7809e7798" . "94b517" => base64_decode("T25EZWxldGVVc2" . "Vy"), "_45ed8675ea7eada7f4efaaf62cef70c" . "3" => base64_decode("T25VcGR" . "hdGVVc2" . "Vy"));
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["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_a889687d4f2e7eed7a091dd1abe9" . "03aa"], PeopleEventType::UPDATE_USER => $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_45ed8675ea7e" . "ada7f4efaaf62" . "cef70c3"], PeopleEventType::DELETE_USER => $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_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);
    }
}