<?php
/**
 * auth/google_status.php — one-glance health check for Google sign-in.
 * Visit https://YOUR-SITE/customer/auth/google_status.php
 * Safe to leave up (never prints the client secret), but you can delete it
 * once everything works.
 */
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/../config/oauth.php';
require_once __DIR__ . '/_helpers.php';

header('Content-Type: text/plain; charset=utf-8');

function yn($b) { return $b ? 'YES' : 'NO'; }

echo "Dabil — Google sign-in status\n";
echo "================================\n";
echo "PHP version          : " . PHP_VERSION . "\n";
echo "cURL available       : " . yn(function_exists('curl_init')) . "\n";
echo "DB connection        : " . yn(isset($conn) && !$conn->connect_error) . "\n";
echo "Client ID set        : " . yn(GOOGLE_CLIENT_ID !== '') . "\n";
echo "Client secret set    : " . yn(GOOGLE_CLIENT_SECRET !== '') . "\n";
echo "OAuth columns present: " . yn(dabil_users_has_oauth_columns($conn))
     . "  (run auth/oauth_migration.sql for full provider tracking)\n";
echo "\n";
echo "Redirect URI this app will send to Google:\n";
echo "  " . dabil_google_redirect_uri() . "\n";
echo "\n";
echo ">> This exact URI must be in your Google Cloud OAuth client's\n";
echo "   'Authorized redirect URIs' list (character for character).\n";
