<?php

namespace App\Http\Controllers;

use App\Traits\Api;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class NotificationsController extends Controller
{
    //
    use Api;

    public function notifications(Request $request)
    {
        // $data = [
        //     'target_app' => 'kedebah-v2-pim',
        // ];


        // $response = $this->get(config('services.kedebah.notification_service_url') . "/notifications", $data);
        // return new JsonResponse($response->object(), $response->status());
    }

    public function notificationsRead(Request $request)
    {
        $data = [
            'notification_id' => $request->input('notification_id'),
        ];


        $response = $this->patch(config('services.kedebah.notification_service_url') . "/notifications", $data);
        // dd($data, $response->json());
        return new JsonResponse($response->object(), $response->status());
    }


    public function notificationsReadAll()
    {

        $response = $this->patch(config('services.kedebah.notification_service_url') . "/notifications");
        // dd($data, $response->json());
        return new JsonResponse($response->object(), $response->status());
    }


    public function destroy(Request $request)
    {
        $data = [
            'notification_id' => $request->input('notification_id'),
        ];


        $response = $this->remove(config('services.kedebah.notification_service_url') . "/notifications", $data);
        // dd($data, $response->json());
        return new JsonResponse($response->object(), $response->status());
    }
}
