<?php


namespace OTP\Helper;

if (defined("\101\102\123\120\x41\x54\110")) {
    goto Rk;
}
die;
Rk:
use OTP\Objects\FormSessionData;
use OTP\Objects\TransactionSessionData;
use OTP\Objects\VerificationType;
final class SessionUtils
{
    static function isOTPInitialized($yU)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto lb;
        }
        return $nt->getIsInitialized();
        lb:
        return FALSE;
    }
    static function addEmailOrPhoneVerified($yU, $rw, $Cw)
    {
        switch ($Cw) {
            case VerificationType::PHONE:
                self::addPhoneVerified($yU, $rw);
                goto IC;
            case VerificationType::EMAIL:
                self::addEmailVerified($yU, $rw);
                goto IC;
        }
        UT:
        IC:
    }
    static function addEmailSubmitted($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto Ki;
        }
        $nt->setEmailSubmitted($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        Ki:
    }
    static function addPhoneSubmitted($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto lx;
        }
        $nt->setPhoneSubmitted($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        lx:
    }
    static function addEmailVerified($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto lE;
        }
        $nt->setEmailVerified($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        lE:
    }
    static function addPhoneVerified($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto Sw;
        }
        $nt->setPhoneVerified($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        Sw:
    }
    static function addStatus($yU, $rw, $k8)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto zz;
        }
        if ($nt->getIsInitialized()) {
            goto s5;
        }
        return;
        s5:
        if (!($k8 === VerificationType::EMAIL)) {
            goto f6;
        }
        $nt->setEmailVerificationStatus($rw);
        f6:
        if (!($k8 === VerificationType::PHONE)) {
            goto gM;
        }
        $nt->setPhoneVerificationStatus($rw);
        gM:
        MoPHPSessions::addSessionVar($yU, $nt);
        zz:
    }
    static function isStatusMatch($yU, $RV, $k8)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto rA;
        }
        switch ($k8) {
            case VerificationType::EMAIL:
                return $RV === $nt->getEmailVerificationStatus();
            case VerificationType::PHONE:
                return $RV === $nt->getPhoneVerificationStatus();
            case VerificationType::BOTH:
                return $RV === $nt->getEmailVerificationStatus() || $RV === $nt->getPhoneVerificationStatus();
        }
        Q1:
        Hg:
        rA:
        return FALSE;
    }
    static function isEmailVerifiedMatch($yU, $PD)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto ET;
        }
        return $PD === $nt->getEmailVerified();
        ET:
        return FALSE;
    }
    static function isPhoneVerifiedMatch($yU, $PD)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto ok;
        }
        return $PD === $nt->getPhoneVerified();
        ok:
        return FALSE;
    }
    static function setEmailTransactionID($R_)
    {
        $k4 = MoPHPSessions::getSessionVar(FormSessionVars::TX_SESSION_ID);
        if ($k4 instanceof TransactionSessionData) {
            goto tl;
        }
        $k4 = new TransactionSessionData();
        tl:
        $k4->setEmailTransactionId($R_);
        MoPHPSessions::addSessionVar(FormSessionVars::TX_SESSION_ID, $k4);
    }
    static function setPhoneTransactionID($R_)
    {
        $k4 = MoPHPSessions::getSessionVar(FormSessionVars::TX_SESSION_ID);
        if ($k4 instanceof TransactionSessionData) {
            goto Vo;
        }
        $k4 = new TransactionSessionData();
        Vo:
        $k4->setPhoneTransactionId($R_);
        MoPHPSessions::addSessionVar(FormSessionVars::TX_SESSION_ID, $k4);
    }
    static function getTransactionId($Cw)
    {
        $k4 = MoPHPSessions::getSessionVar(FormSessionVars::TX_SESSION_ID);
        if (!$k4 instanceof TransactionSessionData) {
            goto oQ;
        }
        switch ($Cw) {
            case VerificationType::EMAIL:
                return $k4->getEmailTransactionId();
            case VerificationType::PHONE:
                return $k4->getPhoneTransactionId();
            case VerificationType::BOTH:
                return MoUtility::isBlank($k4->getPhoneTransactionId()) ? $k4->getEmailTransactionId() : $k4->getPhoneTransactionId();
        }
        SM:
        SF:
        oQ:
        return '';
    }
    static function unsetSession($m3)
    {
        foreach ($m3 as $yU) {
            MoPHPSessions::unsetSession($yU);
            sD:
        }
        hF:
    }
    static function isPhoneSubmittedAndVerifiedMatch($yU)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto Ur;
        }
        return $nt->getPhoneVerified() === $nt->getPhoneSubmitted();
        Ur:
        return FALSE;
    }
    static function isEmailSubmittedAndVerifiedMatch($yU)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto pM;
        }
        return $nt->getEmailVerified() === $nt->getEmailSubmitted();
        pM:
        return FALSE;
    }
    static function setFormOrFieldId($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto TK;
        }
        $nt->setFieldOrFormId($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        TK:
    }
    static function getFormOrFieldId($yU)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto IY;
        }
        return $nt->getFieldOrFormId();
        IY:
        return '';
    }
    static function initializeForm($form)
    {
        $nt = new FormSessionData();
        MoPHPSessions::addSessionVar($form, $nt->init());
    }
    static function addUserInSession($yU, $rw)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto za;
        }
        $nt->setUserSubmitted($rw);
        MoPHPSessions::addSessionVar($yU, $nt);
        za:
    }
    static function getUserSubmitted($yU)
    {
        $nt = MoPHPSessions::getSessionVar($yU);
        if (!$nt instanceof FormSessionData) {
            goto mY;
        }
        return $nt->getUserSubmitted();
        mY:
        return '';
    }
}
