<?php

namespace App\Http\Controllers\ProvinceDashboard\OperatorDialogues;

use App\Http\Controllers\Controller;
use App\Http\Requests\ProvinceDashboard\OperatorDialogs\RateRequest;
use app\Http\Traits\ApiResponse;
use App\Models\OperatorDialogue;
use App\Services\Dashboard\Province\OperatorDialogues\DataTableService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class SupervisorController extends Controller
{
    use ApiResponse;

    public function index(Request $request, DataTableService $dataTableService): JsonResponse
    {
        return response()->json($dataTableService->index($request));
    }

    public function rate(RateRequest $request,OperatorDialogue $operatorDialogue): JsonResponse
    {
        $operatorDialogue->update([
            'supervisor_id' => auth()->user()->id,
            'is_good' => $request->is_good,
            'is_listen' => true,
            'description' => $request->description,
            ]);
        return $this->successResponse();
    }

    public function show(OperatorDialogue $operatorDialogue): JsonResponse
    {
        return $this->successResponse($operatorDialogue);
    }

    public function excel()
    {
        //
    }
}
