<?php
require_once __DIR__ . '/../config/database.php';
require_once __DIR__ . '/../config/constants.php';
require_once __DIR__ . '/../includes/functions.php';

apply_cors();

if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
    send_error('Method not allowed.', 405);
}

$pdo = getDbConnection();
$stmt = $pdo->query(
    "SELECT app_name, support_email, support_whatsapp, support_upi_id, privacy_policy, terms,
            about_us, contact_info, announcement, facebook_url, instagram_url, youtube_url,
            telegram_url, whatsapp_url, linkedin_url, twitter_url, referral_commission
     FROM app_settings WHERE id = 1"
);

send_success(['settings' => $stmt->fetch()]);
