<?php

session_start();
$currentBaseDir = dirname($_SERVER['PHP_SELF']);
include($_SESSION['basedir'] . "core.php");

$svaTool = new svaTool();

$mobilePhone = $_REQUEST['mobilePhone'];
$nextStatus = $_REQUEST['status'];
$errorCode = 0;

if ($errorCode == 0) {


    //################ Inserting logging Information #############
    // Method = 0 -- Login/Loggout     , Event =0 -- Login /1 Loggout
    // Method = 1 -- Pause/Unpaus     , Event =0 -- Pause /1 Unpause

    if ($nextStatus == "pause") {

        $dba->UploadEventInformation($_SESSION['ownerId'], 1, 0);
    } else {

        $dba->UploadEventInformation($_SESSION['ownerId'], 1, 1);
    }



    //############################################################


    $custAstManager->setAgentQueueMemberStatus($mobilePhone, $nextStatus);
}




switch ($errorCode) {

    case 0 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"STATUT CHANGE  AVEC SUCCES !\"  }";
        break;
    case 1 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"ERREUR ! LE NOM DU PARAMETRE EST INVALIDE !\"  }";
        break;
    case 2 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"ERREUR ! VEUILLEZ SAISIR UNE VALEUR POUR CE PARAMETRE. !\"  }";
        break;
}


echo $msg;
?>