<?php
	// required headers
	header("Access-Control-Allow-Origin: *");
	header("Content-Type: application/json; charset=UTF-8");
	 
	// include database and object files
	include_once '../config/database.php';
	include_once '../objects/createrole.php';
	 
	// instantiate database
	$database = new Database();
	$db = $database->getConnection();
	 
	// initialize object
	$userrole = new UserRole($db);
	$data = json_decode(file_get_contents("php://input"));
	$userrole->id=$data->id;
	$userrole->getOneRow();

	$userrole=array(
		"id" => $userrole->id,
		"rolename" =>$userrole->rolename,
		"create_role" => $userrole->create_role,
		"employee" => $userrole->employee,
		"create_account" => $userrole->create_account,
		"change_password" => $userrole->change_password,
		"investor" => $userrole->investor,
		"room" => $userrole->room,
		"agent" => $userrole->agent,
		"item" => $userrole->item,
		"duty_schedule" => $userrole->duty_schedule,
		"attendance" => $userrole->attendance,
		"attendance_update" => $userrole->attendance_update,
		"reservation" => $userrole->reservation,
		"upcoming_arrivals" => $userrole->upcoming_arrivals,
		"arrival" => $userrole->arrival,
		"occupied_list" => $userrole->occupied_list,
		"deleted_reservation_list" => $userrole->deleted_reservation_list,
		"sales_service" => $userrole->sales_service,
		"stock_in" => $userrole->stock_in,
		"stock_out" => $userrole->stock_out,
		"stock_in_report" => $userrole->stock_in_report,
		"stock_out_report" => $userrole->stock_out_report,
		"stock_balance_report" => $userrole->stock_balance_report,
		"purchase" => $userrole->purchase,
		"purchase_report" => $userrole->purchase_report,
		"monthly_report" => $userrole->monthly_report,
		"cash_book_report" => $userrole->cash_book_report,
		"coa" => $userrole->coa,
		"expense" => $userrole->expense,
		"income" => $userrole->income,
		"expense_report" => $userrole->expense_report,
		"income_report" => $userrole->income_report,
		"attendance_report" => $userrole->attendance_report,
		"guest_report" => $userrole->guest_report,
		"arrival_report" => $userrole->arrival_report,
		"departure_report" => $userrole->departure_report
	);

	echo json_encode($userrole);
		
?>