<?php

namespace App\Http\Controllers\Api\V1;

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

class ThemeController extends Controller
{
    /**
     * Return the app theme chosen by admin (for mobile app to apply).
     * Public endpoint – no auth required.
     */
    public function show(): JsonResponse
    {
        $theme = Setting::get('app_theme', 'blinkit');

        if (! in_array($theme, ['blinkit', 'dark', 'light'], true)) {
            $theme = 'blinkit';
        }

        return response()->json([
            'theme' => $theme,
            'currency_symbol' => Setting::get('currency_symbol', '$'),
        ]);
    }
}
