<?php
/**
 * GET /api/auth/oauth_facebook.php
 * "Sign in with Facebook" entry point. Mirrors oauth_google.php exactly -
 * see that file's TODO list for the full integration steps. Facebook's
 * equivalent pieces:
 *   - App ID/Secret from developers.facebook.com (Admin > Settings)
 *   - Consent redirect: https://www.facebook.com/v19.0/dialog/oauth?client_id=...&redirect_uri=...&scope=email
 *   - Token exchange + profile fetch against Facebook's Graph API in
 *     oauth_facebook_callback.php
 */

require_once __DIR__ . '/../config/database.php';
require_once __DIR__ . '/../includes/settings.php';

$pdo = Database::connect();
$appId = get_setting($pdo, 'oauth_facebook_app_id', '');

if ($appId === '') {
    header('Location: ' . APP_URL . '/login.html?oauth_error=facebook_not_configured');
    exit;
}

// TODO: build the real Facebook consent-screen redirect once $appId is set.
header('Location: ' . APP_URL . '/login.html?oauth_error=facebook_not_implemented');
exit;
