<?php

namespace App\Http\Controllers\API\v1;

use App\Http\Controllers\Controller;
use App\Models\User;
use App\Notifications\BiometricConnection;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use App\Models\BiometricNotification;
use Illuminate\Http\Response;

class BiometricNotificationController extends Controller
{
    public function index(Request $request)
    {
        $users = User::whereIn('id', [11197, 11507])->get();
        // print_r($request->input('success'));

        try {
            Notification::send($users , new BiometricConnection($request->all()));
            
            return response()->json([
                'status' => true,
                'message' => 'Notification sent successfully!',
                'status_code' => 200,
            ], 200);
        } catch (\Exception $e) {

            return response()->json([
                'status' => false,
                'message' => 'Failed to send notification: ' . $e->getMessage(),
                'status_code' => 500,
            ], 500);
        }
    }
}
