<?php
namespace Claromentis\Pages\TrashCan;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array("_798ecc821" . "6dcacb7cd2" . "d2788fa03f" . "96f" => base64_decode("aW" . "50"), "_62d701c3c53404f06345" . "eb35720a47b4" => base64_decode("aXNfbnVtZX" . "JpYw=="), "_b81b3f220ac66c436348631f6248e" . "c93" => base64_decode("Q2FuJ3Qgc2F2ZSBpbmNvcnJlY3RseSBp" . "bml0aWFsaXplZCBUcmFzaCBPYmplY3Qg" . "aW4gZGF0YWJhc2U="), "_e5ca3abd91063380bbf7948820" . "605671" => base64_decode("VHJhc2ggQ2FuIGRvZXN" . "uJ3Qgd29yayBmb3IgZ3" . "Vlc3Rz"), "_014d150db81857ea04cd2" . "5c23050b7e5" => base64_decode("c2V" . "0dH" . "lwZ" . "Q=="), "_0c519e721cc3079fbb252fbd60f" . "d7904" => base64_decode("dGltZQ" . "=="));
use AuthUser;
use Claromentis\Core\Services;
use Claromentis\Core\TrashCan\TrashcanObject\TrashObject;
use Claromentis\Pages\Repository\TrashCanRepository;





abstract class TrashObjectPages extends TrashObject
{
    const TRASH_TYPE_SITE = 1;
    const TRASH_TYPE_PAGE = 2;
    const TRASH_TYPE_LINK = 3;
    public $site_id = 0;
    public $type = self::TRASH_TYPE_SITE;
    public $id = 0;
    public $obj_id = 0;
    public $title = 0;
    public $aggregation = 0;
    public $deletion_date = 0;
    public $description = '';
    public $user_id = 0;
    public $orig_location = '';
    public abstract function CreateFromObject($_b15aac3aa29c10ea6d1228f58cb9a7e8);
    public abstract function GetObjectTypeName();
    
    
    
    
    
    
    
    
    
    public function Save($_fbceb246654d6317b175985211e6c69f = false)
    {
        if (!$this->id) {
            if (!AuthUser::I()->GetId() && !$_fbceb246654d6317b175985211e6c69f) {
                return $this->SetErrMsg($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_e5ca3abd91063380bbf794882060" . "5671"]);
            }
            $this->user_id = $_fbceb246654d6317b175985211e6c69f ? 0 : AuthUser::I()->GetId();
            $this->deletion_date = $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_0c519e7" . "21cc3079" . "fbb252fb" . "d60fd790" . "4"]();
        }
        $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_014d150db" . "81857ea04c" . "d25c23050b" . "7e5"]($this->site_id, $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_798ecc821" . "6dcacb7cd2" . "d2788fa03f" . "96f"]);
        $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_014d150db81857ea04" . "cd25c23050b7e5"]($this->type, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_798ecc8216dcacb7cd2d27" . "88fa03f96f"]);
        $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_014d150db81857ea04cd25c23050" . "b7e5"]($this->obj_id, $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_798ecc8216dcacb7cd2d27" . "88fa03f96f"]);
        $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_014d150db81857ea04cd25c23050b" . "7e5"]($this->aggregation, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_798ecc8216d" . "cacb7cd2d278" . "8fa03f96f"]);
        $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_014d150db8" . "1857ea04cd2" . "5c23050b7e5"]($this->user_id, $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_798ecc8216dcacb7cd2d2788fa" . "03f96f"]);
        if (!$this->obj_id || !$this->aggregation) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_b81b3f220ac66c436348631f624" . "8ec93"]);
        }
        
        
        $_579ab9f26bdbc4b7cad74d2c19bb48e0 = Services::I()->{TrashCanRepository::class};
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_62d701c3" . "c53404f06" . "345eb3572" . "0a47b4"]($this->id) && $this->id > 0) {
            $_579ab9f26bdbc4b7cad74d2c19bb48e0->UpdateTrashCanObject($this->site_id, $this->obj_id, $this->aggregation, $this->title, $this->description, $this->orig_location, $this->type, $this->id);
        } else {
            
            
            
            $_81ff2488a2ed5fff110cd3efabea55fe = $_579ab9f26bdbc4b7cad74d2c19bb48e0->isObjectInTrash($this->obj_id, $this->aggregation);
            if ($_81ff2488a2ed5fff110cd3efabea55fe == 0) {
                $this->id = $_579ab9f26bdbc4b7cad74d2c19bb48e0->AddTrashCanObject($this->site_id, $this->obj_id, $this->aggregation, $this->title, $this->description, $this->orig_location, $this->user_id, $this->deletion_date, $this->type);
            } else {
                $this->id = $_81ff2488a2ed5fff110cd3efabea55fe;
            }
        }
        return $this->id;
    }
    public function SetType(int $_dadf790baf241afac942824c1e6e37c4)
    {
        $this->type = $_dadf790baf241afac942824c1e6e37c4;
    }
}