<?php
namespace Claromentis\Pages\TrashCan;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] ?: array()) + array("_0c519e721cc3079fbb252fbd60" . "fd7904" => base64_decode("dGltZQ=" . "="), "_e5ca3abd91063380bbf7948" . "820605671" => base64_decode("VHJhc2ggQ2FuIGRvZXNuJ" . "3Qgd29yayBmb3IgZ3Vlc3" . "Rz"), "_62d701c3c53404f06345eb3572" . "0a47b4" => base64_decode("aXNfbnVtZXJ" . "pYw=="), "_798ecc8216dcacb7cd2d2" . "788fa03f96f" => base64_decode("aW5" . "0"), "_014d150db81857ea04cd25c23050b7" . "e5" => base64_decode("c2V0dHlw" . "ZQ=="), "_b81b3f220ac66c436348" . "631f6248ec93" => base64_decode("Q2FuJ3Qgc2F2ZSBpbmNvcnJlY3RseSBp" . "bml0aWFsaXplZCBUcmFzaCBPYmplY3Qg" . "aW4gZGF0YWJhc2U="));
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["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_e5ca3abd91063380bbf794" . "8820605671"]);
            }
            $this->user_id = $_fbceb246654d6317b175985211e6c69f ? 0 : AuthUser::I()->GetId();
            $this->deletion_date = $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_0c519e721cc3079fbb252" . "fbd60fd7904"]();
        }
        $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_014d150db81857ea" . "04cd25c23050b7e5"]($this->site_id, $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_798ecc82" . "16dcacb7c" . "d2d2788fa" . "03f96f"]);
        $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_014d150db81857e" . "a04cd25c23050b7e" . "5"]($this->type, $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_798ecc8216dcacb7cd2d2788" . "fa03f96f"]);
        $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_014d150db818" . "57ea04cd25c23" . "050b7e5"]($this->obj_id, $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_798ecc821" . "6dcacb7cd2" . "d2788fa03f" . "96f"]);
        $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_014d150db81857ea04cd25c23050b" . "7e5"]($this->aggregation, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_798ecc8216dcacb7cd2d2788fa03f9" . "6f"]);
        $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_014d150db81857ea04cd25c2305" . "0b7e5"]($this->user_id, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_798ecc82" . "16dcacb7c" . "d2d2788fa" . "03f96f"]);
        if (!$this->obj_id || !$this->aggregation) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_b81b3f220ac66c436348631f" . "6248ec93"]);
        }
        
        
        $_579ab9f26bdbc4b7cad74d2c19bb48e0 = Services::I()->{TrashCanRepository::class};
        if ($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_62d701c3c53404f0" . "6345eb35720a47b4"]($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;
    }
}