<?php

namespace App\Http\Controllers;

use App\Http\Requests\DeviceTokenRequest;
use App\Services\DeviceTokenService;
use Illuminate\Http\JsonResponse;

class DeviceTokenController extends Controller
{
    public function __construct(private DeviceTokenService $deviceTokenService) {}

    public function store(DeviceTokenRequest $request): JsonResponse
    {
        $this->deviceTokenService->register($request->validated());

        return $this->successResponse(code: 201);
    }

    public function destroy(string $token): JsonResponse
    {
        $this->deviceTokenService->remove($token);

        return $this->successResponse();
    }
}
