<?php
namespace Claromentis\Core\Component\ValueType;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array("_67a0d624aebcceb0abd5ce56a53ff0" . "6f" => base64_decode("ZGF0" . "ZQ=="), "_aed8da0f1" . "9091214b78" . "f803510485" . "17c" => base64_decode("c3RybGV" . "u"), "_c8b38c7133c2e846" . "0c1cca42230ac6c2" => base64_decode("dGltZQ=" . "="), "_5e30c4717ced" . "36cff9e93e19a" . "5c576cc" => base64_decode("aXNfc3R" . "yaW5n"), "_7f628626dd1d55c71" . "b1fc0932ffd1d2c" => base64_decode("aXNfYX" . "JyYXk="));
use Claromentis\Core\Date\DateFormatter;




class TypeDateTime implements ValueType
{
    
    
    
    
    
    
    
    
    public function Serialize($value)
    {
        if ($value === null) {
            return null;
        }
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_7f62862" . "6dd1d55c" . "71b1fc09" . "32ffd1d2" . "c"]($value)) {
            $_67a0d624aebcceb0abd5ce56a53ff06f = \Date::CreateFrom($value[$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_67a0d624aebcceb0abd5ce56a53ff06" . "f"]], $value[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_c8b38c7133c2e8460c1cca422" . "30ac6c2"]]);
        } else {
            $_67a0d624aebcceb0abd5ce56a53ff06f = \Date::CreateFrom($value->date, $value->time);
        }
        if (!$_67a0d624aebcceb0abd5ce56a53ff06f) {
            throw new \Exception();
        }
        
        
        $_0dbe978d64aca9dbe1aa157ff74b5602 = (string) $_67a0d624aebcceb0abd5ce56a53ff06f->getDate(DATE_FORMAT_TIMESTAMP);
        return $_0dbe978d64aca9dbe1aa157ff74b5602;
    }
    public function Unserialize($value)
    {
        if (empty($value)) {
            return null;
        }
        $_67a0d624aebcceb0abd5ce56a53ff06f = new \Date($value);
        return [$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_67a0d624aebcce" . "b0abd5ce56a53ff" . "06f"] => $_67a0d624aebcceb0abd5ce56a53ff06f->getDate(DateFormatter::SHORT_DATE), $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c8b38c7133c2e8460c1cca" . "42230ac6c2"] => $_67a0d624aebcceb0abd5ce56a53ff06f->getDate(DATE_FORMAT_CLA_TIME)];
    }
    public function Normalize($value)
    {
        if ($value === null) {
            return null;
        }
        if ($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_5e30c47" . "17ced36c" . "ff9e93e1" . "9a5c576c" . "c"]($value) && $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_aed8da0f190" . "91214b78f803" . "51048517c"]($value) === 14) {
            $value = $this->Unserialize($value);
        }
        return $value;
    }
    public function Modify($_fd536f3a4b49ad5514a4e7a5db1c6248, $_33e21c745c95d91261fc8f7b4b930af0)
    {
        return $this->Normalize($_33e21c745c95d91261fc8f7b4b930af0);
    }
}