#!/usr/bin/env python3
"""Blur client names - large regions to catch everything."""

from PIL import Image, ImageFilter
import os

input_path = "/Users/assafdagan/.clawdbot/media/inbound/f01c84e1-5f12-4bcf-bfb8-257edba844eb.jpg"
output_path = "/Users/assafdagan/clawd/output/blurred-final.jpg"

img = Image.open(input_path)
w, h = img.size

# Use LARGE regions to definitely catch the client names
blur_regions = [
    # "Phat Foods:" + "Spoken:" + "SparkBeyond..." all in Active Projects section
    # Cover entire section from y=115 to y=300
    (25, 115, 750, 310),
    
    # "*1. Phat Foods Deadline Approaching*" header AND first bullet
    # Cover y=385 to y=440
    (0, 385, 650, 445),
    
    # "*2. Spoken Project (Dovi Remarks)*" header
    # Cover y=570 to y=630
    (0, 565, 680, 635),
    
    # Tomorrow's Priorities section - both Phat Foods and Dovi lines
    # Cover y=1060 to y=1200  
    (20, 1055, 450, 1200),
]

result = img.copy()

for (x1, y1, x2, y2) in blur_regions:
    cropped = img.crop((x1, y1, x2, y2))
    blurred = cropped.filter(ImageFilter.GaussianBlur(radius=30))
    result.paste(blurred, (x1, y1))

os.makedirs(os.path.dirname(output_path), exist_ok=True)
result.save(output_path, quality=95)
print(f"Saved: {output_path}")
