<?php
namespace Claromentis\OAuth2;

$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] ?: array()) + array("i" . "d" => base64_decode("aWQ" . "="), "_7f628626dd1d55c71b1fc09" . "32ffd1d2c" => base64_decode("aXNf" . "YXJy" . "YXk="), "_803d546" . "c35dc6bb" . "74c3cd32" . "b95fcac3" . "e" => base64_decode("U0VMRUNUIHJlZGlyZWN0X3VyaSBGUk9NIG9hdXRoX2NsaWVudF9yZWRpcmVjdF91cmlzIFd" . "IRVJFIGNsaWVudF9pZCBlcTpzdHI6Y2lk"), "_2fcdfa6" . "cef44130" . "05aae9ae" . "3df6426e" . "2" => base64_decode("b2F1dGhfY2" . "xpZW50cw=="), "_70995c4fd2bccfc9aca" . "f06d8444852c7" => base64_decode("SU5TRVJUIElOVE8gb2F1dGhfY2xpZW50X3JlZGly" . "ZWN0X3VyaXMgKGNsaWVudF9pZCwgcmVkaXJlY3Rf" . "dXJpKSBWQUxVRVMgKHN0cjpjaWQsIHN0cjp1KQ=="), "_653c065ce13fcc898c85e35e3" . "f0ab5bc" => base64_decode("c2" . "Vj" . "cm" . "V0"), "_8ff0c68bbee5" . "fe19849c7f82c" . "d0d6a0f" => base64_decode("cmVkaXJ" . "lY3RfdX" . "Jpcw=="), "_a591754a8ddcdbda" . "9c80f1db4d911e14" => base64_decode("aXNf" . "bnVs" . "bA=="), "_c372545d70ea3c510" . "62f75445d687929" => base64_decode("REVMRVRFIEZST00gb2F1dGhfY2xpZW50X3JlZGlyZWN0X3VyaXMgV0hFUkUgY2xpZW50X2lkIGVxOnN0cjpjaWQ" . "="), "na" . "me" => base64_decode("bmFtZQ=" . "="));
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["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_2fcdfa6cef44" . "13005aae9ae3d" . "f6426e2"], $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["i" . "d"]);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["i" . "d"], ObjectsStorage::T_STRING, 255);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["n" . "a" . "m" . "e"], ObjectsStorage::T_STRING, 255);
        $storage->MapDbColumn($this, $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_653c065ce13fcc898c85e35e" . "3f0ab5bc"], ObjectsStorage::T_STRING, 255);
    }
    
    
    
    
    public function GetRedirectURIs()
    {
        if ($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_a591754a8d" . "dcdbda9c80f" . "1db4d911e14"]($this->redirect_uris)) {
            $db = Services::I()->GetDb();
            $_189840d11056515e52402d1412a0b6e4 = $db->query($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_803d546c35dc6bb" . "74c3cd32b95fcac3" . "e"], $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["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_7f628626d" . "d1d55c71b1" . "fc0932ffd1" . "d2c"]($this->redirect_uris)) {
            $db = Services::I()->GetDb();
            $_15afa2d452391af5d01076584c0d792a = $this->id;
            $db->query($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_c372545d70e" . "a3c51062f754" . "45d687929"], $_15afa2d452391af5d01076584c0d792a);
            foreach ($this->redirect_uris as $_797ea62e9ab498d38c2781088fc553f6) {
                $db->query($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_70995c4fd2bccfc9aca" . "f06d8444852c7"], $_15afa2d452391af5d01076584c0d792a, $_797ea62e9ab498d38c2781088fc553f6);
            }
        }
        return true;
    }
    public function ResetSecret()
    {
        $this->SetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_653c065ce13fcc898c85e35e3f0ab5" . "bc"], \CryptUtils::GetRandomString());
    }
    public static function CreateNew($_24b81fd345b39bff8a1dfa1607826ec3)
    {
        
        
        $client = static::Create([$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["i" . "d"] => \CryptUtils::GetRandomString() . \CryptUtils::GetRandomString(), $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_653c065ce13fcc898c85e35e3f0a" . "b5bc"] => \CryptUtils::GetRandomString(), $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["nam" . "e"] => $_24b81fd345b39bff8a1dfa1607826ec3[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["n" . "a" . "m" . "e"]]]);
        $client->SetRedirectURIs($_24b81fd345b39bff8a1dfa1607826ec3[$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_8ff0c68bbee5fe19849c" . "7f82cd0d6a0f"]]);
        return $client;
    }
}