import db
import json

def test_get_users():
    search = ""
    page = 1
    size = 50
    offset = (page - 1) * size
    
    base_query = "SELECT id, email, first_name, last_name, phone, role, can_chat, ip_address, created_at FROM users"
    count_query = "SELECT COUNT(*) as total FROM users"
    params = []
    
    if search and search.strip():
        # logic...
        pass
        
    base_query += " ORDER BY id DESC LIMIT %s OFFSET %s"
    
    users = db.execute_query(base_query, tuple(params + [size, offset]))
    total = db.execute_query(count_query, tuple(params))[0]['total']
    
    print(f"Total: {total}")
    print(f"Users: {json.dumps(users, indent=2, default=str)}")

if __name__ == "__main__":
    test_get_users()
