<?php

namespace App\Http\Controllers\Api\V1\Client;

use App\Http\Controllers\Controller;
use App\Models\Contact;
use Illuminate\Http\Request;

class ContactController extends Controller
{
    public function __invoke(Request $request)
    {
        $validated = $request->validate([
            'name' => 'required|max:191',
            'email' => 'required|email',
            'message' => 'required|max:1000',
        ]);

        Contact::create($validated);

        return response()->json(['success' => true, 'message' => __('Your message has been sent successfully.')]);
    }
}
