import re
import sys

def check_indentation(filename):
    with open(filename, 'r', encoding='utf-8') as f:
        lines = f.readlines()
    
    print(f"Analizando {filename}...")
    
    for i, line in enumerate(lines):
        line_num = i + 1
        if line_num in [1541, 1692, 1726]:
            prev_indent = len(lines[i-1]) - len(lines[i-1].lstrip())
            current_indent = len(line) - len(line.lstrip())
            next_indent = len(lines[i+1]) - len(lines[i+1].lstrip())
            
            print(f"Línea {line_num}:")
            print(f"  Indentación anterior: {prev_indent}")
            print(f"  Indentación actual: {current_indent}")
            print(f"  Indentación siguiente: {next_indent}")
            print(f"  Contenido: '{line.rstrip()}'")
            print(f"  Contenido línea anterior: '{lines[i-1].rstrip()}'")
            print(f"  Contenido línea siguiente: '{lines[i+1].rstrip()}'")
            print()

if __name__ == "__main__":
    check_indentation("app/services/tariff_detector.py")
