<?php

namespace App\Http\Controllers\ProvinceDashboard\SystemMessages;

use App\Http\Controllers\Controller;
use App\Http\Requests\ProvinceDashboard\SystemMessages\RateRequest;
use app\Http\Traits\ApiResponse;
use App\Models\SystemMessage;
use App\Services\Dashboard\Province\SystemMessages\SupervisorService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class SupervisorController extends Controller
{
    use ApiResponse;
    /**
     * Display a listing of the resource.
     */
    public function index(Request $request, SupervisorService $supervisorService): JsonResponse
    {
        return response()->json($supervisorService->datatable($request));
    }

    public function excel()
    {

    }

    /**
     * Store a newly created resource in storage.
     */
    public function rate(RateRequest $request, SystemMessage $systemMessage): JsonResponse
    {
        $systemMessage->update([
            'message_quality' => $request->message_quality,
            'format_quality' => $request->format_quality,
            'description' => $request->description,
        ]);
        return $this->successResponse();
    }

    /**
     * Display the specified resource.
     */
    public function show(SystemMessage $systemMessage): JsonResponse
    {
        return $this->successResponse($systemMessage);
    }
}
