<?php

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();

use App\Models\Subscription;

echo "=== All Subscriptions ===\n\n";

$subscriptions = Subscription::orderBy('id', 'desc')->get();

foreach ($subscriptions as $sub) {
    echo "Subscription ID: {$sub->id}\n";
    echo "  User ID: {$sub->user_id}\n";
    echo "  Package: {$sub->package_name}\n";
    echo "  Amount: \${$sub->amount}\n";
    echo "  Status: {$sub->status}\n";
    echo "  Session ID: " . ($sub->stripe_session_id ?? 'NULL') . "\n";
    echo "  Customer ID: " . ($sub->stripe_customer_id ?? 'NULL') . "\n";
    echo "  Subscription ID: " . ($sub->stripe_subscription_id ?? 'NULL') . "\n";
    echo "  Gateway Sub ID: " . ($sub->gateway_subscription_id ?? 'NULL') . "\n";
    echo "  Activated At: " . ($sub->activated_at ?? 'NULL') . "\n";
    echo "  Created: {$sub->created_at}\n";
    echo "\n";
}
