<?php

namespace App\Http\Controllers\BridgingBPJS;

use App\Service\Bpjs\Bridging;
use Illuminate\Http\Request;

class LembarPengajuanKlaim extends BpjsController
{
    protected $bpjs;

    public function __construct()
    {
        parent::__construct();
        $this->bpjs = new Bridging($this->consid, $this->timestamp, $this->signature);
    }

    public function DataLpk($tgl, $jenisPelayanan)
    {
        $endpoint = "LPK/TglMasuk/" . $tgl . "/JnsPelayanan/" . $jenisPelayanan;
        $prb = $this->bpjs->getRequest($endpoint);
        return $prb;
    }

    // --------- pembuatan LPK-----------------------//
    public function InsertLpk(request $request)
    {
        $data = json_encode($request->all());
        $endpoint = "LPK/insert";
        $lpk = $this->bpjs->postRequest($endpoint, $data);
        return $lpk;
    }

    public function UpdateLpk(request $request)
    {
        $data = json_encode($request->all());
        $endpoint = "LPK/update";
        $lpk = $this->bpjs->putRequest($endpoint, $data);
        return $lpk;
    }

    public function DeleteLpk(request $request)
    {
        $data = json_encode($request->all());
        $endpoint = "LPK/delete";
        $lpk = $this->bpjs->deleteRequest($endpoint, $data);
        return $lpk;
    }
}
