<?php
namespace Claromentis\OAuth2;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_70995c4fd2bccfc9acaf06d" . "8444852c7" => base64_decode("SU5TRVJUIElOVE8gb2F1dGhfY2xpZW50X3JlZGlyZWN0X3VyaXMgKGNsaWVudF9pZCwgcmVk" . "aXJlY3RfdXJpKSBWQUxVRVMgKHN0cjpjaWQsIHN0cjp1KQ=="), "_8ff0c68b" . "bee5fe198" . "49c7f82cd" . "0d6a0f" => base64_decode("cmVkaXJl" . "Y3RfdXJp" . "cw=="), "_803d546c35dc6b" . "b74c3cd32b95fca" . "c3e" => base64_decode("U0VMRUNUIHJlZGlyZWN0X3VyaSBGUk9NIG9hdXRoX2NsaWVudF9yZWR" . "pcmVjdF91cmlzIFdIRVJFIGNsaWVudF9pZCBlcTpzdHI6Y2lk"), "_c372545d70ea3c51062f75445" . "d687929" => base64_decode("REVMRVRFIEZST00gb2F1dGhfY2x" . "pZW50X3JlZGlyZWN0X3VyaXMgV0" . "hFUkUgY2xpZW50X2lkIGVxOnN0c" . "jpjaWQ="), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_a591754a8ddcdbda9c80f1db" . "4d911e14" => base64_decode("aXNfbnVsbA" . "=="), "_653c065ce13fcc898c85e35" . "e3f0ab5bc" => base64_decode("c2" . "Vj" . "cm" . "V0"), "_7f628626dd1d55c71b1fc0932f" . "fd1d2c" => base64_decode("aXN" . "fYX" . "JyY" . "Xk="), "_2fcdfa6ce" . "f4413005aa" . "e9ae3df642" . "6e2" => base64_decode("b2F1dGh" . "fY2xpZW" . "50cw=="), "na" . "me" => base64_decode("bmF" . "tZQ" . "=="));
use Claromentis\Core\DAL;
use Claromentis\Core\Services;
use ObjectsStorage;










class Client extends \ActiveRecord
{
    protected $redirect_uris = null;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function InitDbMapping(ObjectsStorage $storage)
    {
        $storage->MapDbTable($this, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_2fcdfa6cef4413005aae9a" . "e3df6426e2"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["i" . "d"]);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["i" . "d"], ObjectsStorage::T_STRING, 255);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["nam" . "e"], ObjectsStorage::T_STRING, 255);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_653c065ce1" . "3fcc898c85e" . "35e3f0ab5bc"], ObjectsStorage::T_STRING, 255);
    }
    
    
    
    
    public function GetRedirectURIs()
    {
        if ($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_a591754a8ddcdbda9c80f1db4d91" . "1e14"]($this->redirect_uris)) {
            $db = Services::I()->GetDb();
            $_189840d11056515e52402d1412a0b6e4 = $db->query($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_803d546c35dc6bb74c3" . "cd32b95fcac3e"], $this->id);
            $this->redirect_uris = $_189840d11056515e52402d1412a0b6e4->fetchAllValues();
        }
        return $this->redirect_uris;
    }
    
    
    
    
    public function SetRedirectURIs($_688eb32b375d969d8f026c11a2cd33ea)
    {
        $this->redirect_uris = $_688eb32b375d969d8f026c11a2cd33ea;
    }
    public function Save()
    {
        if (!parent::Save()) {
            return false;
        }
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_7f62862" . "6dd1d55c" . "71b1fc09" . "32ffd1d2" . "c"]($this->redirect_uris)) {
            $db = Services::I()->GetDb();
            $_15afa2d452391af5d01076584c0d792a = $this->id;
            $db->query($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_c372545d70ea3c5106" . "2f75445d687929"], $_15afa2d452391af5d01076584c0d792a);
            foreach ($this->redirect_uris as $_797ea62e9ab498d38c2781088fc553f6) {
                $db->query($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_70995c4" . "fd2bccfc" . "9acaf06d" . "8444852c" . "7"], $_15afa2d452391af5d01076584c0d792a, $_797ea62e9ab498d38c2781088fc553f6);
            }
        }
        return true;
    }
    public function ResetSecret()
    {
        $this->SetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_653c065ce13fcc898c85e35" . "e3f0ab5bc"], \CryptUtils::GetRandomString());
    }
    public static function CreateNew($_24b81fd345b39bff8a1dfa1607826ec3)
    {
        
        
        $client = static::Create([$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["i" . "d"] => \CryptUtils::GetRandomString() . \CryptUtils::GetRandomString(), $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_653c065" . "ce13fcc8" . "98c85e35" . "e3f0ab5b" . "c"] => \CryptUtils::GetRandomString(), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["n" . "a" . "m" . "e"] => $_24b81fd345b39bff8a1dfa1607826ec3[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["na" . "me"]]]);
        $client->SetRedirectURIs($_24b81fd345b39bff8a1dfa1607826ec3[$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_8ff0c68bbee5fe1" . "9849c7f82cd0d6a0" . "f"]]);
        return $client;
    }
}