<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Translation;
use Illuminate\Http\JsonResponse;

class TranslationController extends Controller
{
    public function index(string $locale): JsonResponse
    {
        $translations = Translation::where('locale', $locale)
            ->pluck('value', 'key');

        return response()->json([
            'success' => true,
            'data'    => $translations,
        ]);
    }
}
