<?php
declare(strict_types=1);

namespace App\Modules\Api\Controllers\Api;

use App\Core\ApiController;
use App\Core\Request;
use App\Core\Response;
use App\Core\App;

final class ConfigController extends ApiController
{
    public function index(Request $request): Response
    {
        $config = App::getInstance()->config('mobile', []);

        return $this->successResponse([
            'min_version' => $config['min_version'] ?? ['ios' => '1.0.0', 'android' => '1.0.0'],
            'maintenance' => [
                'enabled' => $config['maintenance']['enabled'] ?? false,
                'message' => $config['maintenance']['message_ar'] ?? null,
            ],
            'features' => $config['features'] ?? [],
        ]);
    }
}
