<?php

use function PHPSTORM_META\type;
include "../includes/init.php";
include "middleware.php";


extract($_GET);
if (!isset($resource) || !isset($type)) {
    http_response_code(404);
    header("HTTP/1.0 404 Not Found");
    echo '404 Not Found';
    return false;
}

switch ($resource) {
    case 'verification':

        if ($type == 'nin') {
            // echo $type;
            verify_nin();
        } elseif ($type == 'nin_only') {
            verify_nin_only();
        } elseif ($type == 'nin_v1') {
            verify_nin_v1();
        } elseif ($type == 'bvn') {
            verify_bvn();
        } elseif ($type == 'nin_v4') {
            verify_nin_v4();
        }
        
        else {
            http_response_code(404);
            header("HTTP/1.0 404 Not Found");
            echo '404 Not Found';
        }
        break;

    default:
        http_response_code(404);
        header("HTTP/1.0 404 Not Found");
        echo '404 Not Found';
        break;
}

function get_user_detail()
{

    if (auth_middleware()) {
    }
    // response(200, User::find_all());
}

function  verify_nin()
{

    // print_r($_POST);
    // extract($_POST);

    $user_id = auth_middleware();
    if ($user_id) {
        include("./components/myidentitypass.php");
    }
}


function  verify_nin_v4()
{

    // print_r($_POST);
    // extract($_POST);

    $user_id = auth_middleware();
    if ($user_id) {
        include("./components/ninv4.php");
    }
}


function  verify_nin_only()
{

    $vnin = generate_vnin();

    $user_id = auth_middleware();
    if ($user_id) {
        include("./components/myidentitypass.php");
    }
}
function  verify_nin_v1()
{

    $vnin = generate_vnin();

    $user_id = auth_middleware();
    if ($user_id) {
        include("./components/myidentitypass.php");
    }
}

function  verify_bvn()
{
    $user_id = auth_middleware();
    if ($user_id) {
        include("./components/myidentitypass_bvn.php");
    }
}