<?php

namespace App\Services;

use App\Services\KedebahService;
use Illuminate\Http\Client\Response;

class StaffInfoService extends KedebahService
{
    public function getStaffInfo(int $staffId): Response
    {
        // dd($staffId);
        $response = $this->get("/pim/staff/$staffId");
        return $response;
    }

    public function createStaffPersonalInfo(array $data = []): Response
    {
        $response = $this->post("/staff", $data);
        return $response;

    }

    public function updateStaffInfo(int $staffId, string $section = '', $data = []): Response
    {

        // dd($staffId, $data, $section);
        $response = $this->patch(
            path: "/pim/staff/$staffId/",
            data: $data,
            queryParams: ['section' => $section]
        );

        // dd($response->object());
        return $response;

    }

    public function deleteStaff(int $staffId): Response
    {
        $response = $this->patch("/staff/$staffId/");

        return $response;

    }

    protected function apiUrl(): string|null
    {
        return config('services.kedebah.hr_service_url');
    }

}