<?php

namespace App\Http\Controllers\Frontend;

use App\Http\Controllers\Controller;
use App\Http\Requests\Frontend\ContactRequest;
use App\Mail\ContactMessageMail;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Mail;
use Illuminate\View\View;

class PageController extends Controller
{
    public function about(): View
    {
        return view('frontend.pages.about');
    }

    public function contact(): View
    {
        return view('frontend.pages.contact');
    }

    public function sendContact(ContactRequest $request): RedirectResponse
    {
        Mail::to(config('niyarasa.contact.email'))->send(new ContactMessageMail($request->validated()));

        return back()->with('success', "Thanks for reaching out — we'll get back to you soon.");
    }
}
