<?php

namespace App\Domains\Admin\Controllers;

use App\Models\Tenant;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class ManagedTenantGdprGetController extends CommonController
{
    public function __invoke(string $slug, Request $request): JsonResponse
    {
        $tenant = Tenant::where('slug', $slug)->firstOrFail();

        return response()->json([
            'gdpr_text' => $tenant->gdpr_text ?? '',
            'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/gdpr',
        ]);
    }
}
