from datetime import date

AS_OF = date(2026, 11, 10)

def main(input):
    output = []
    for row in input:
        days = (date.fromisoformat(row["renewal_date"]) - AS_OF).days
        in_window = row["status"] == "active" and days <= 30
        action = "none" if not in_window else "assign_owner" if not row["owner"].strip() else "contact_owner"
        output.append(dict(row, days_to_renewal=days,
            renewal_stage="overdue" if days < 0 else "upcoming", renewal_action=action))
    return output
