<?php

declare(strict_types=1);

namespace App\Http\Controllers\Notification;

use App\Http\Controllers\Controller;
use App\Support\ApiResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserNotificationController extends Controller
{
    /**
     * Handle the incoming request.
     */
    public function __invoke(Request $request)
    {
        $user = Auth::guard('api')->user();
        if (! $user) {
            return ApiResponse::response(message: 'شما وارد سایت نشده اید!', status: 420);
        }

        $notifications = $user->notifications;

        return ApiResponse::success($notifications);
    }
}
