<?php

require_once 'vendor/autoload.php';

use App\Models\User;
use App\Models\JointAccount;
use App\Models\JointAccountMember;
use Illuminate\Support\Facades\Auth;

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

echo "=== Reset Test Data ===\n\n";

try {
    // Reset user uloubi7@gmail.com back to pending status
    $user = User::where('email', 'uloubi7@gmail.com')->first();
    
    if ($user) {
        $member = JointAccountMember::where('joint_account_id', 1)
            ->where('user_id', $user->id)
            ->first();
        
        if ($member) {
            $member->update([
                'status' => 'pending',
                'joined_at' => null
            ]);
            
            echo "Reset user {$user->email} back to pending status\n";
        }
    }
    
    echo "Test data reset complete!\n";
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
} 