"""Fix indentation of P2 models that got nested inside PayoutRecord."""
path = '/home/vincent/projects/command-sovereignty/app/models.py'

with open(path) as f:
    lines = f.readlines()

fixed = []
for i, line in enumerate(lines):
    lineno = i + 1
    if lineno >= 2173:
        # Remove leading 4 spaces (unnested from PayoutRecord)
        if line.startswith('    '):
            line = line[4:]
    fixed.append(line)

with open(path, 'w') as f:
    f.writelines(fixed)

print("Fixed indentation for lines 2173+")

# Verify key lines
for i in [2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2188, 2189, 2190, 2349, 2350, 2351, 2352, 2358, 2359]:
    if i < len(fixed):
        print(f"L{i}: {fixed[i][:80]}")
