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

require_once 'vendor/autoload.php';

class Wsbpjssep extends CI_Controller
{	
   
		public function __construct()
		{
			parent::__construct();
			$this->load->model('data_menu');
            $this->load->library('LibHttpRequest');				
		}


		public function insertSepOld()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/1.1/insert';
			echo $this->HttpRequest("POST",$url,$params) ;		
		}

		public function updateSepOld()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/1.1/Update';
			echo $this->HttpRequest("PUT",$url,$params) ;		
		}

		
		public function deleteSepOld()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/Delete';
			echo $this->HttpRequest("DELETE",$url,$params) ;		
		}

		public function insertSepNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/2.0/insert';
			echo $this->HttpRequest("POST",$url,$params) ;		
		}

		public function updateSepNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/2.0/update';
			echo $this->HttpRequest("PUT",$url,$params) ;		
		}

		
		public function deleteSepNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/2.0/delete';
			echo $this->HttpRequest("DELETE",$url,$params) ;		
		}

			
		public function  cariSep()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noSep = $this->GetJsonObject($obj->{'noSep'}) ;	
			$url = 'SEP/'.$noSep;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function  suplesiJasaRaharja()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noKartuPeserta = $this->GetJsonObject($obj->{'noKartuPeserta'}) ;	
            $tanggalPelayananAtauSep = $this->GetJsonObject($obj->{'tanggalPelayananAtauSep'}) ;
			$url = 'sep/JasaRaharja/Suplesi/'.$noKartuPeserta.'/tglPelayanan/'.$tanggalPelayananAtauSep;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function suplesiDataIndukKecelakaan()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noKartuPeserta = $this->GetJsonObject($obj->{'noKartuPeserta'}) ;	
			$url = 'sep/KllInduk/List/'.$noKartuPeserta;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function approvalPenjaminanPengajuan()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'Sep/pengajuanSEP';
			echo $this->HttpRequest("POST",$url,$params) ;		
		}
        
        public function approvalPengajuanSep()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'Sep/aprovalSEP';
			echo $this->HttpRequest("POST",$url,$params) ;		
		}

        public function updateTanggalPulang()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'Sep/updtglplg';
			echo $this->HttpRequest("PUT",$url,$params) ;		
		}

        public function updateTanggalPulangNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/2.0/updtglplg';
			echo $this->HttpRequest("PUT",$url,$params) ;		
		}

        public function listDataUpdateTanggalPulang()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$bulan = $this->GetJsonObject($obj->{'bulan'}) ;	
            $tahun = $this->GetJsonObject($obj->{'tahun'}) ;
            $filter = $this->GetJsonObject($obj->{'filter'}) ;
			$url = 'Sep/updtglplg/list/bulan/'.$bulan.'/tahun/'.$tahun.'/'.$filter;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function integrasiSepDenganInacbg()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noSep = $this->GetJsonObject($obj->{'noSep'}) ;
			$url = 'sep/cbg/'.$noSep;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function dataSepInternalNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noSep = $this->GetJsonObject($obj->{'noSep'}) ;
			$url = 'SEP/Internal/'.$noSep;
			echo $this->HttpRequest("GET",$url) ;		
		}


        public function deleteSepInternalNew()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$params = $obj ;

			$url = 'SEP/Internal/delete';
			echo $this->HttpRequest("DELETE",$url,$params) ;		
		}

        public function getFingerPrint()
		{	
            $json = file_get_contents('php://input');
			$obj = json_decode($json);

			$noKartuPeserta = $this->GetJsonObject($obj->{'noKartuPeserta'}) ;	
            $tanggalPelayanan = $this->GetJsonObject($obj->{'tanggalPelayanan'}) ;
			$url = 'SEP/FingerPrint/Peserta/'.$noKartuPeserta.'/TglPelayanan/'.$tanggalPelayanan;
			echo $this->HttpRequest("GET",$url) ;	
		}

        public function getListFingerPrint()
		{	
            $json = file_get_contents('php://input');
			$obj = json_decode($json);

            $tanggalPelayanan = $this->GetJsonObject($obj->{'tanggalPelayanan'}) ;
			$url = 'SEP/FingerPrint/List/Peserta/TglPelayanan/'.$tanggalPelayanan;
			echo $this->HttpRequest("GET",$url) ;	
		}
        
        public function HttpRequest($method,$endPoint,$params="",$contentType="application/x-www-form-urlencoded")
		{			
			echo $this->libhttprequest->vclaim($method,$endPoint,$params,$contentType);
			exit();			
		}
        
	
		function GetJsonObject($obj){
			return isset($obj) ? $obj : ""; 
		}
	
	

}