<?php
namespace App\Http\Controllers\v2019;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\JsonResponse;

class EventsController extends Controller
{ 
    public function __construct(Request $request) {
        if($request->has('debug') && $request->input('debug') == true) {
			$this->debug = true;
            include_once "/home/steelmin/public_html/api/pre_function/sm_events.php";	
        }
    }
    
    public function getEventListing(Request $request)
    {      
	   $result = array();
	   if($this->debug == TRUE){

	   } else {
		   include_once "/home/steelmin/public_html/api/storage/v2019/event/events_list.php";
	   }
	   
	   $resourceType = "APP";		
	   if ($request->has('resourceType'))
		   $resourceType = strtolower($request->input('resourceType'));
	   
	   if($resourceType=='web'){
		   $code = 1001;
		   $message = "Success";
		   if ($request->has('memid') && $request->input('memid')!=''){
			   include_once "/home/steelmin/public_html/api/storage/v2019/web/web_events_list_post.php";
		   }else{
			   include_once "/home/steelmin/public_html/api/storage/v2019/web/web_events_list_post.php";
		   }
	   } else {
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			$code = 1001;
			$message = "Success";
		}
	 }  
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
	}
	
    public function getEventSchedule(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/eventSchedule_list.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getEventSpeakerListing(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/eventSpeaker.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }


    public function getEventAttendeeListing(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/attendees_list.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getEventSponsor(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/sponsor_list.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getEventExhibitor(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/exhibitor_list.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

     public function getEventBookmark(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/get_bookmarked.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getEventAccommodation(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/accommodation_list.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getEventQR(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/get_QR_code_details.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function saveScannedContact(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/save_scanned_contact.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    }

    public function getScannedContacts(Request $request)
    {      
	   $result = array();
	   include_once "/home/steelmin/public_html/api/storage/v2019/event/get_scanned_contacts.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
				///not loggedin/visitor///
				$code = 2013;
				$message = "User not found.";
			}else{
				///full data///
				$code = 1001;
				$message = "Success";
			}
        }else{
			///not loggedin/visitor///
			
			$code = 1001;
			$message = "Success";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
	}
	
	public function getEventsCount(Request $request){
		$result = array();
		$resourceType = "APP";		
		if ($request->has('resourceType'))
			$resourceType = strtolower($request->input('resourceType'));
		
		if($resourceType=='web'){
			$code = 1001;
			$message = "Success";
			include_once "/home/steelmin/public_html/api/storage/v2019/web/web_report_count_post.php";
		} elseif($resourceType=='app') {
			///
		}else{
			$code = 2001;
			$message = "invalid input";
		}
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
	}
}    
    
?>