<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use App\Http\Requests\Api\V1\Forms\Newsletter\NewsletterSubscriptionStoreRequest;
use App\Models\CMS\Marketing\NewsletterUser;
use Illuminate\Http\JsonResponse;

class NewsletterSubscriptionController extends Controller
{
    /**
     * (Marketing) Subscribe to newsletter
     */
    public function store(NewsletterSubscriptionStoreRequest $request): JsonResponse
    {
        NewsletterUser::insertOrIgnore($request->validated());

        return response()->rest();
    }
}
