<?php

class Jres
{

	public function  success (array $data=[], $msg="")
	{
		header('content-type:application/json');
		echo json_encode(['status'=>"1",'data'=>$data,'message'=>$msg]); exit;
	}
	public function  failure( $msg="", array $data=[])
	{
		header('content-type:application/json');
		echo json_encode(['status'=>'0','data'=>$data,'message'=>$msg]); exit;
	}

	public function  successotp ($data, $msg="")
	{
		header('content-type:application/json');
		if( empty($data) )
		{		
			echo json_encode(['status'=>'1','message'=>$msg]); exit;
		}
		else
		{
			echo json_encode(['status'=>'1','otp'=>$data,'message'=>$msg]); exit;
		}
	}

	public function success_message($msg)
	{
		header('content-type:application/json');
		echo json_encode(['status'=>'1','message'=>$msg]); exit;
	}
}
