#!/usr/bin/env python3
"""Blur client names - v5 with measured positions from original."""

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-status-v5.jpg"

img = Image.open(input_path)
w, h = img.size
print(f"Image: {w}x{h}")

# Carefully measured from original image
# Image is 986x1600
blur_regions = [
    # "*Phat Foods:*" first bullet - "Phat Foods" text
    (30, 118, 220, 155),
    
    # "*Spoken:* Dovi remarks" - blur "Spoken" and "Dovi"
    (30, 180, 520, 220),
    
    # "*General:* SparkBeyond, White Space, Finally Foods"
    (170, 225, 690, 275),
    
    # "*1. Phat Foods Deadline Approaching*" - full line
    (0, 345, 590, 400),
    
    # "*2. Spoken Project (Dovi Remarks)*" - full line
    (0, 520, 620, 575),
    
    # "1. *Phat Foods check-in*" - in Tomorrow section
    (25, 1000, 380, 1055),
    
    # "2. *Complete Dovi review*"
    (25, 1075, 395, 1130),
]

result = img.copy()

for i, (x1, y1, x2, y2) in enumerate(blur_regions):
    cropped = img.crop((x1, y1, x2, y2))
    blurred = cropped.filter(ImageFilter.GaussianBlur(radius=25))
    result.paste(blurred, (x1, y1))
    print(f"Blurred: y={y1}-{y2}")

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