// 👤 User Repository
// @Repository
// interface UserRepository extends JpaRepository<User, Long>

print "💾 Loading User Repository...";

// @Repository
function UserRepository_save(name, email) {
    print "💾 UserRepository.save() - Saving user: " + name;
    // Auto-generate SQL: INSERT INTO users (name, email) VALUES (?, ?)
    print "📝 SQL: INSERT INTO users (name, email) VALUES ('" + name + "', '" + email + "')";
    print "✅ User saved with auto-generated ID";
    return true;
}

function UserRepository_findById(id) {
    print "🔍 UserRepository.findById(" + str(id) + ")";
    // Auto-generate SQL: SELECT * FROM users WHERE id = ?
    print "📝 SQL: SELECT * FROM users WHERE id = " + str(id);
    print "✅ User found with ID: " + str(id);
    return true;
}

function UserRepository_findAll() {
    print "📋 UserRepository.findAll()";
    // Auto-generate SQL: SELECT * FROM users
    print "📝 SQL: SELECT * FROM users";
    print "✅ Retrieved all users from database";
    return 3;
}

function UserRepository_findByEmail(email) {
    print "🔍 UserRepository.findByEmail('" + email + "')";
    // Auto-generate SQL: SELECT * FROM users WHERE email = ?
    print "📝 SQL: SELECT * FROM users WHERE email = '" + email + "'";
    print "✅ User found by email";
    return true;
}

function UserRepository_deleteById(id) {
    print "🗑️ UserRepository.deleteById(" + str(id) + ")";
    // Auto-generate SQL: DELETE FROM users WHERE id = ?
    print "📝 SQL: DELETE FROM users WHERE id = " + str(id);
    print "✅ User deleted from database";
    return true;
}

function UserRepository_updateById(id, name, email) {
    print "🔄 UserRepository.updateById(" + str(id) + ")";
    print "📝 SQL: UPDATE users SET name = '" + name + "', email = '" + email + "' WHERE id = " + str(id);
    print "✅ User updated successfully";
    return true;
}

print "✅ User Repository loaded successfully";
