<?php

namespace App\Http\Controllers\Public;

use App\Http\Controllers\Controller;
use App\Models\TermsSection;
use Illuminate\View\View;

class TermsController extends Controller
{
    public function __invoke(): View
    {
        $activeTermsText = TermsSection::where('active', true)->first();

        if (! $activeTermsText) {
            abort(404);
        }
        $activeTermsText = $activeTermsText->contentTranslationKey->getTranslation();

        return view('public.terms', compact('activeTermsText'));
    }
}