<?php

namespace App\Http\Controllers\Settings;

use App\Http\Controllers\Controller;
use App\Services\ServiceSIMBG;
use Illuminate\Http\Request;
use Exception;
class SyncronizeController extends Controller
{
    protected $service_simbg;
    public function __construct(ServiceSIMBG $service_simbg){
        $this->service_simbg = $service_simbg;
    }
    public function index(Request $request){
        return view('settings.syncronize.index');
    }

    public function syncPbgTask(){
        $res = $this->service_simbg->syncTaskList();
        return $res;
    }

    public function syncronizeTask(Request $request){
        $res = $this->service_simbg->syncTaskList();
        return redirect()->back()->with('success', 'Processing completed successfully');
    }

    public function getUserToken(){
        $res = $this->service_simbg->getToken();
        return $res;
    }

    public function syncIndexIntegration(Request $request, $uuid){
        $token = $request->get('token');
        $res = $this->service_simbg->syncIndexIntegration($uuid, $token);
        return $res;
    }

    public function syncTaskDetailSubmit(Request $request, $uuid){
        $token = $request->get('token');
        $res = $this->service_simbg->syncTaskDetailSubmit($uuid, $token);
        return $res;
    }
}
