<?php

// Use this namespace
use Steampixel\Route;

// Include router class
include 'src/Steampixel/Route.php';

include 'fun/db_config.php';
include 'fun/function.php';
include 'fun/get.php';
// // include 'gettttt.php';

include 'fun/set.php';
include 'fun/upd.php';
include 'fun/del.php';

// Define a global basepath
 define('BASEPATH_PGC', '/api/');
// define('BASEPATH', '/ecmapi/');

// If your script lives in a subfolder you can use the following example
// Do not forget to edit the basepath in .htaccess if you are on apache
// define('BASEPATH','/api/v1');



// Add base route (startpage)
Route::add('/', function () {
 date_default_timezone_set('Asia/Yangon'); 
    echo date('Y-m-d H:i:s');

// echo "API TEST";
});

Route::add('/set/MultiFun', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
// UserId,Latitude,Longitude,Status,Remark
  if (isset($input['insertQuery'])) {
    $response = set_multitdata($input["insertQuery"]);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');

Route::add('/set/ImageMultiUpload', function () {
    $inputJSON = file_get_contents('php://input');
    $input = json_decode($inputJSON, TRUE); // convert JSON into associative array
      $response = array();
    if (isset($input['OnlineImage'])) {
        $response = set_multituploadImage($input["OnlineImage"]);
    } else {
        $response["status"] = 2;
        $response["message"] = "Missing mandatory parameters";
    }

    echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');

Route::add('/get/item', function () {
  $response = array("aung");
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Get all category (or) by limit", ['start', 'limit'], "get/all/category");


Route::add('/get/ExistData/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($value,$value1,$value2,$value3,$value4) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  $response = get_ExistData($value,$value1,$value2,$value3,$value4);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/CallAllData/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($tblname,$colnm,$colnm1,$Val) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  $response = get_CallAllData($tblname,$colnm,$colnm1,$Val);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/get_CallAllData', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array $tblname,$colnm,$colnm1,$Val
  $response = array();
   $response = get_CallAllData($input['tblname'],$input['colnm'],$input['colnm1'],$input['Val']);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/NoParCase/([a-zA-Z0-9-/ \|:.,_]*)', function ($Case) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_All(get_Querystring($Case));
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/OneParCase/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($Case,$value) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_All(get_getPerOne($Case,$value));
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');


Route::add('/get/Get_dis/([a-zA-Z0-9-/ \|:.,_]*)', function ($Case) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = GetCase_dis($Case);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

// get_AddressId
Route::add('/get/InfoplcAds/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($D,$T,$TS,$Q,$VT,$V) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_AddressId($D,$T,$TS,$Q,$VT,$V);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/SubMeusChild1/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($CurrentMenuId,$State) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_SubMeusChild1($CurrentMenuId,$State);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/SubMeusChild2/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($CurrentMenuId,$State,$State1) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_SubMeusChild2($CurrentMenuId,$State,$State1);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/SubMeus/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($CurrentMenuId,$State) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_SubMeus($CurrentMenuId,$State);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/StateTypez', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_StateType();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/StateTypeO', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_StateTypeO();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/AccTblPermissionAll', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_AccTblPermissionAll();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/StateAll', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_StateAll();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');


Route::add('/get/NewAccId', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_NewAccId();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/AccountMenuPerMIT', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_AccountMenuPermission();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/AllTblAccounts', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_AllTblAccounts();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');


Route::add('/get/MenuRelationData', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_MenuRelationData();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/AccountMenuSqlite', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_AccountMenuSqlite();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/GetCase', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = GetCase();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/GetCaseBY/([a-zA-Z0-9-/ \|:.,_]*)', function ($RegNo) { 
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = GetCaseBY($RegNo);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');



Route::add('/get/MenuRelationSqlite', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_MenuRelationSqlite();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/MenuNames', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
   $response = get_MenuNames();
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');


Route::add('/get/TwoParCase/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*),([a-zA-Z0-9-/ \|:.,_]*)', function ($Case,$value,$value1) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  $response = get_All(get_getPerTwo($Case,$value,$value1));
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/Login_Account/([a-zA-Z0-9-/ \|:.,_]*)/([a-zA-Z0-9-/ \|:.,_]*)', function ($value,$value1) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  $response = get_Login_Account($value,$value1);
   echo json_encode($response, JSON_PRETTY_PRINT);
    
}, ['get', 'post'], "Get all acmdetail (or) by limit", ['start', 'limit'], 'get/all/acmdetail');

Route::add('/get/ItemsNames/([a-zA-Z0-9-/ \|:.,_]*)', function ($qry) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($qry)) {
    $response = get_Items($qry);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


// Route::add('/get/insertOrGet', function () {
//   $inputJSON = file_get_contents('php://input');
//   $input = json_decode($inputJSON, TRUE); //convert JSON into array
//   $response = array();
  
//   //Check for Mandatory parameters Address_D,Address_T,Address_TS,Address_Q,Address_VT,Address_V
//   if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) {
//     $response = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
//   } else {
//     $response["status"] = 2;
//     $response["message"] = "Missing mandatory parameters";
//   }
//   echo json_encode($response, JSON_PRETTY_PRINT);
// }, ['get', 'post'], "Insert new category", ['name'], 'set/category');

Route::add('/get/insertOrGet', function () {
  $inputJSON = file_get_contents('php://input');
  $data = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  
//   $input = $data['CaseAddressObj'] ?? null;
  
  
//   //Check for Mandatory parameters Address_D,Address_T,Address_TS,Address_Q,Address_VT,Address_V
//   if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) 
//   {
//     $response["CaseAddress"] = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
//   } 
//   else 
//   {
//     $response["status"] = 2;
//     $response["message"] = "Missing mandatory parameters";
//   }
  $RegisterNo= $data['RegisterNo'] ?? null;
  $CaseTypeId = $data['CaseTypeId'] ?? null;
  $PropertyTypeId = $data['PropertyTypeId'] ?? null;
  $Date = $data['Date'] ?? null;
  $PropertyId = $data['PropertyId'] ?? null;
  $Lat_Long = $data['Lat_Long'] ?? nPropertyIdl;
  $GroundArea = $data['GroundArea'] ?? null;
  $GroundUnitId = $data['GroundUnitId'] ?? null;
  $BuildingArea = $data['BuildingArea'] ?? null;
  $BuildingAreaUnitId = $data['BuildingAreaUnitId'] ?? null;
  $BuildingType = $data['BuildingType'] ?? null;
  $FloorType = $data['FloorType'] ?? null;
  $ContractPrice = $data['ContractPrice'] ?? null;
  $PayTypeId = $data['PayTypeId'] ?? null;
  $BnakId = $data['BnakId'] ?? null;
  $OwnerPh = $data['OwnerPh'] ?? null;
  $GuestPh = $data['GuestPh'] ?? null;
  $ProposerPh = $data['ProposerPh'] ?? null;
  $OtherType = $data['OtherType'] ?? null;
  $OtherArea = $data['OtherArea'] ?? null;
  $OtherUnit = $data['OtherUnit'] ?? null;
  
  $NrcConfimStateId = $data['NrcConfimStateId'] ?? null;
  $RegisterStateId = $data['RegisterStateId'] ?? null;
   $BuildingTypeId= $data['BuildingTypeId'] ?? null;
    $ProposedPrice= $data['ProposedPrice'] ?? null;
     $OwnerTypeId= $data['OwnerTypeId'] ?? null;
     $StateId= $data['StateId'] ?? null;
  $ImporterSt= $data['ImporterSt'] ?? null;
  $SellerSt = $data['SellerSt'] ?? null;
  $BuyerSt = $data['BuyerSt'] ?? null;
  $CaseSt = $data['CaseSt'] ?? null;
  $CaseFullAddress= $data['CaseFullAddress'] ?? null;
  $ImporterFullAddress = $data['ImporterFullAddress'] ?? null;
  $BuyerFullAddress = $data['BuyerFullAddress'] ?? null;
  $SellerFullAddresst = $data['SellerFullAddress'] ?? null;
    $OnlineImage = $data['BuyerFullAddress'] ?? null;
  //Next Case  
  $input = $data['CaseAddressObj'] ?? null;
  //$response["CaseAddress"]   $response["ImporterAddress"] $response["BuyerAddress"] $response["SellerAddress"] 
  //
  if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) //,,,
  {
    $response["CaseAddress"] = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
     $CaseAddressId =$response["CaseAddress"]["id"];
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  //Next Importer
  $input = $data['ImporterAddressObj'] ?? null;
  
  if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) 
  {
    $response["ImporterAddress"] = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
    $ImporterAddressId =$response["ImporterAddress"]["id"]; 
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
   //Next buyer
  $input = $data['BuyerAddressObj'] ?? null;
  if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) 
  {
    $response["BuyerAddress"] = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
    $BuyerAddressId =$response["BuyerAddress"]["id"];
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
    //Next seller
  $input = $data['SellerAddressObj'] ?? null;
  if (isset($input['Address_Dv'])&&isset($input['Address_Ds'])&&isset($input['Address_T'])&&isset($input['Address_TS'])&&isset($input['Address_Q'])&&isset($input['Address_VT'])&&isset($input['Address_V']) ) 
  {
    $response["SellerAddress"] = insertOrGetId($input['Address_Dv'],$input['Address_Ds'],$input['Address_T'],$input['Address_TS'],$input['Address_Q'],$input['Address_VT'],$input['Address_V']);
    $SellerAddressId =$response["SellerAddress"]["id"]; 
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  
    //Next ImporterNrcData
  $input = $data['ImporterNrcData'] ?? null;
  if (isset($input['NrcNo'])&&isset($input['Name'])) 
  {
    $response["ImporterNrcData"] = insertOrGetNrcId($input['NrcNo'],$input['Name']);
  
      $ProposerNrcId =$response["ImporterNrcData"]["id"];
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  
   //Next BuyerNrcData
  $input = $data['BuyerNrcData'] ?? null;
  if (isset($input['NrcNo'])&&isset($input['Name'])) 
  {
    $response["BuyerNrcData"] = insertOrGetNrcId($input['NrcNo'],$input['Name']);
    $GuestNrcId =$response["BuyerNrcData"]["id"];
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
   //Next SellerNrcData
  $input = $data['SellerNrcData'] ?? null;
  if (isset($input['NrcNo'])&&isset($input['Name'])) 
  {
    $response["SellerNrcData"] = insertOrGetNrcId($input['NrcNo'],$input['Name']);
    $OwnerNrcId =$response["SellerNrcData"]["id"];
  } 
  else 
  {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
    
   
  if ($RegisterNo!=null ) 
  {
      $response["Success"] =1;
       $response["InsertData"] = set_CaseData($RegisterNo, $Date, $CaseTypeId, $PropertyTypeId, $PropertyId, $Lat_Long, $CaseAddressId, $ImporterAddressId, $BuyerAddressId, $SellerAddressId, $GroundArea, $GroundUnitId, $BuildingArea, $BuildingAreaUnitId, $BuildingTypeId, $ContractPrice, $ProposedPrice, $OwnerTypeId, $PayTypeId, $BnakId, $OwnerNrcId, $OwnerPh, $GuestNrcId, $StateId, $GuestPh, $ProposerNrcId, $ProposerPh, $NrcConfimStateId, $RegisterStateId, $BuildingType, $OtherType, $OtherArea, $FloorType,$OtherUnit,$ImporterSt,$SellerSt,$BuyerSt,$CaseSt,$OnlineImage,$CaseFullAddress,$ImporterFullAddress,$BuyerFullAddress,$SellerFullAddresst);
  }
  else
  
    $response["Success"] = 111;
//       if ($GroundArea!=null) 
//   {
//       $response["Success"] =1;
//   }
//   else
  
//     $response["Success"] = 0;
//   $response["ReturnVal"] = ReturnVal($val["vall"]);
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


Route::add('/get/NrcDta', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  
  //$NrcNo,$Name
  if (isset($input['NrcNo'])&&isset($input['Name'])) {
    $response = insertOrGetNrcId($input['NrcNo'],$input['Name']);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


Route::add('/get/insertOrGetttt/([a-zA-Z0-9-/ \|:.,_]*)', function ($qry) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($qry)) {
    $response = insertOrGetId($qry);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


Route::add('/get/Items_Menu/([a-zA-Z0-9-/ \|:.,_]*)', function ($qry) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($qry)) {
    $response = get_Items_Menu($qry);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


Route::add('/get/AccountPermission/([a-zA-Z0-9-/ \|:.,_]*)', function ($Case) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($input['value']) && isset($input['value1']) ) {
    $response = get_AccountPermission($Case);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


Route::add('/get/PTwoParCase/([a-zA-Z0-9-/ \|:.,_]*)', function ($Case) {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($input['value']) && isset($input['value1']) ) {
    $response = get_Login($Case,$input["value"],$input["value1"]);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');

Route::add('/get/GetUserAdmin', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
  if (isset($input['Username']) && isset($input['Password']) ) {
    $response = get_Login($input["Username"],$input["Password"]);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');




//SET

Route::add('/set/TempPhoto', function () {
  $inputJSON = file_get_contents('php://input');
  $input = json_decode($inputJSON, TRUE); //convert JSON into array
  $response = array();
  //Check for Mandatory parameters
// UserId,Latitude,Longitude,Status,Remark
  if (isset($input['Image'])) {
    $response = set_Photo($input["Image"]);
  } else {
    $response["status"] = 2;
    $response["message"] = "Missing mandatory parameters";
  }
  echo json_encode($response, JSON_PRETTY_PRINT);
}, ['get', 'post'], "Insert new category", ['name'], 'set/category');


//put

// Route::add('/upd/alllocationtype/([a-zA-Z0-9]*)', function ($UserId) {
//   $inputJSON = file_get_contents('php://input');
//   $input = json_decode($inputJSON, TRUE); //convert JSON into array
//   $response = array();
//   //Check for Mandatory parameters
// // AcmId,Photos,ShopId,PtoORmap
//   if ( isset($input['location'])) {
//     $response = upd_locationtype($UserId,$input["location"]);
//   } else {
//      $response["status"] = 2;
//      $response["message"] = "Missing mandatory parameters";
//   }
//   echo json_encode($response, JSON_PRETTY_PRINT);
// }, ['get', 'post','put'], "Update category", ['name'], "upd/category/1");



//del

// Route::add('/del/LocationType/([a-zA-Z0-9]*)', function ($SpecialId) {
//   // h();
//   //  Get the input request parameters [For INPUT is in JSON format]
//   //  $inputJSON = file_get_contents('php://input');
//   //  $input = json_decode($inputJSON, TRUE); //convert JSON into array
//   $response = array();
// //   $tbl="tblCompany";
//   $response = del_LocationType($SpecialId);
//   // echo '<pre>';
//   echo json_encode($response, JSON_PRETTY_PRINT);
// }, ['get', 'post','delete'], "Delete category by id", [], "del/category/1");



// Run the Router with the given Basepath
Route::run(BASEPATH_PGC);

// Enable case sensitive mode, trailing slashes and multi match mode by setting the params to true
// Route::run(BASEPATH, true, true, true);
