#!/bin/bash

# Script to find snake_case patterns in TypeScript/JavaScript files
# This will help identify variables, functions, and properties that need to be converted to camelCase

echo "Searching for snake_case patterns in source files..."

# Search for common snake_case patterns in variable names, function names, and properties
# Exclude node_modules and .next directories

# Pattern explanation:
# - \b\w+_\w+\b matches any word with underscore (snake_case)
# - Exclude database-related terms that should stay snake_case
# - Focus on variable declarations, function declarations, and object properties

find /home/ccuser/the-50-dollar-app/src -type f \( -name "*.ts" -o -name "*.tsx" \) -exec grep -Hn "\b[a-z]+_[a-z_]+\b" {} \; | \
grep -v "node_modules" | \
grep -v "\.next" | \
grep -v "created_at\|updated_at\|user_id\|job_id\|match_id\|conversation_id\|message_id\|payment_id\|subscription_id\|abn_number\|company_name\|first_name\|last_name\|phone_number\|email_address\|postal_code\|street_address" | \
sort | uniq > /tmp/snake_case_findings.txt

echo "Results saved to /tmp/snake_case_findings.txt"
echo "Found $(wc -l < /tmp/snake_case_findings.txt) potential snake_case patterns"