<?php

declare(strict_types=1);

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use App\Settings\GeneralSettings;
use App\Settings\SeoSettings;
use Illuminate\Http\JsonResponse;

class MetaController extends Controller
{
    public function show(GeneralSettings $general, SeoSettings $seo): JsonResponse
    {
        return response()->json([
            'name' => $general->site_name,
            'url' => $general->site_url,
            'description' => $general->site_description,
            'theme' => $general->active_theme,
            'seo' => [
                'default_description' => $seo->default_description,
                'default_keywords' => $seo->default_keywords,
                'robots_index' => $seo->robots_index,
            ],
            'api' => [
                'version' => 'v1',
                'openapi' => url('/docs/api/openapi.yaml'),
            ],
        ]);
    }
}
