<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class PayrollController extends Controller
{
    public function run(Request $request): JsonResponse
    {
        return response()->json([
            'status' => 'queued',
            'message' => 'Payroll calculation job accepted.',
            'period' => $request->only(['starts_at', 'ends_at', 'branch_id']),
        ], 202);
    }

    public function approve(int $period): JsonResponse
    {
        return response()->json(['status' => 'approved', 'period_id' => $period]);
    }

    public function lock(int $period): JsonResponse
    {
        return response()->json(['status' => 'locked', 'period_id' => $period]);
    }
}
