<?php


defined('BASEPATH') or exit('No direct script access allowed');

function ApiBaseUrl()
{
	$data = array(
		'url' => "https://aspgen.vaaptech.com:9000/",
		// 'url' => "https://aspgenpre.vaaptech.com:9000/",
		// 'url' => "http://localhost:3000/",
		'productID' => "62c807133d9ee4045ab78d4d",
		'clientID' => "641af82518d4894cda6b944a",
		"clientCode"=>'6905'
	);
	return $data;
}


function GetProjectName()
{
	if (PROJECT_NAME !== null && PROJECT_NAME != '') {
		return PROJECT_NAME;
	} else {
		return 'Vaap Technologies Inc';
	}
}


function GetProjectkeyword()
{
	if (PROJECT_KEYWORD !== null && PROJECT_KEYWORD != '') {
		return PROJECT_NAME;
	} else {
		return 'Vaap Technologies Inc';
	}
}


function getParkingAreaAnalytics($clientCode,$date,$lat,$long)
{
	$CI = &get_instance();
	$ch = curl_init();

	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

	curl_setopt($ch, CURLOPT_URL, ApiBaseUrl()['url'] . 'api/parkinglot/getParkingAreaAnalytics');

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	//curl_setopt($ch, CURLOPT_POST, 1);
	// \"serviceTypes\":\"".$serviceType."\", 

$data = array(
			"clientCode" => $clientCode,
			"date" => $date,
			"long" =>$long,
			"lat" => $lat
		
	);
	$data_string = json_encode($data);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string );


	$headers = array();
	$headers[] = 'Content-Type: application/json';
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$result = curl_exec($ch);
	$response = json_decode($result);

	if (curl_errno($ch)) {
		echo 'Error:' . curl_error($ch);
	}

	curl_close($ch);
	$upComming = json_decode(json_encode($response), true);

	
	return $response;
}