<?php

namespace App\Http\Controllers\API\v1;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Util;
use App\Services\PhysicalAttendanceGateCode;
use Illuminate\Http\Request;

class PhysicalAttendanceGateController extends Controller
{
    /**
     * Current rotating code for the registration counter display.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Services\PhysicalAttendanceGateCode  $gate
     * @return \Illuminate\Http\JsonResponse
     */
    public function __invoke(Request $request, PhysicalAttendanceGateCode $gate)
    {
        $electionId = Util::getCurrentElection();

        return response()->json($gate->currentPayload($electionId));
    }
}
