<?php

namespace App\Http\Controllers;

use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class ContactController extends Controller
{
    public function store(Request $request): RedirectResponse
    {
        $validated = $request->validate([
            'first_name' => ['required', 'string', 'max:100'],
            'last_name' => ['required', 'string', 'max:100'],
            'company' => ['nullable', 'string', 'max:150'],
            'email' => ['required', 'email', 'max:255'],
            'service' => ['nullable', 'string', 'max:100'],
            'message' => ['required', 'string', 'max:5000'],
        ]);

        // TODO: wire up actual mail delivery once SMTP/mail credentials are
        // available — e.g. Mail::to('info@movexgroup.net')->send(new ContactEnquiryMail($validated));
        // Intentionally not sending anything yet; no credentials configured.

        return redirect()
            ->route('contact')
            ->with('status', 'Thanks — a logistics specialist will respond within 24 hours.');
    }
}
