#!/usr/bin/env python3
"""Generate Morning Joe's Rundown Word document — April 4, 2026"""

from docx import Document
from docx.shared import Inches, Pt, Cm, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.section import WD_ORIENT
from docx.oxml.ns import qn
from datetime import datetime
import os

doc = Document()

# === PAGE SETUP ===
section = doc.sections[0]
section.top_margin = Cm(1.5)
section.bottom_margin = Cm(1.5)
section.left_margin = Cm(2)
section.right_margin = Cm(2)

# === STYLES ===
NAVY = RGBColor(0x00, 0x2B, 0x5B)
GOLD = RGBColor(0xC5, 0x96, 0x1C)
BLACK = RGBColor(0x00, 0x00, 0x00)
GRAY = RGBColor(0x55, 0x55, 0x55)

style = doc.styles['Normal']
font = style.font
font.name = 'Calibri'
font.size = Pt(10)
font.color.rgb = BLACK

def add_heading_styled(text, level=1):
    h = doc.add_heading(text, level=level)
    for run in h.runs:
        run.font.color.rgb = NAVY
        run.font.name = 'Calibri'
    return h

def add_gold_line():
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(2)
    p.paragraph_format.space_after = Pt(4)
    run = p.add_run('━' * 80)
    run.font.color.rgb = GOLD
    run.font.size = Pt(6)

def add_item(text, bold_prefix=None):
    p = doc.add_paragraph(style='List Bullet')
    if bold_prefix:
        run = p.add_run(bold_prefix)
        run.bold = True
        run.font.size = Pt(10)
        run.font.name = 'Calibri'
        p.add_run(text)
    else:
        p.runs[0].font.size = Pt(10) if p.runs else None
        p.text = text
    return p

def add_body(text):
    p = doc.add_paragraph(text)
    p.paragraph_format.space_after = Pt(4)
    return p

def add_checkbox(text):
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(2)
    p.paragraph_format.left_indent = Cm(0.5)
    run = p.add_run('☐  ' + text)
    run.font.size = Pt(10)
    run.font.name = 'Calibri'
    return p

def add_sub_heading(text):
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(6)
    p.paragraph_format.space_after = Pt(2)
    run = p.add_run(text)
    run.bold = True
    run.font.color.rgb = GOLD
    run.font.size = Pt(11)
    run.font.name = 'Calibri'
    return p

# === TITLE ===
title = doc.add_paragraph()
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title.add_run('MORNING JOE\'S RUNDOWN')
run.bold = True
run.font.size = Pt(22)
run.font.color.rgb = NAVY
run.font.name = 'Calibri'

subtitle = doc.add_paragraph()
subtitle.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = subtitle.add_run('Saturday, April 4, 2026  •  Easter Weekend  •  🦞')
run.font.size = Pt(11)
run.font.color.rgb = GOLD
run.font.name = 'Calibri'

context = doc.add_paragraph()
context.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = context.add_run('Joe is in Charleston, SC with the family  •  Markets closed (Easter weekend)')
run.font.size = Pt(9)
run.font.color.rgb = GRAY
run.font.name = 'Calibri'

add_gold_line()

# === SECTION 1: WEATHER ===
add_heading_styled('§1 — WEATHER', level=2)

weather_data = [
    ('Ship Bottom, NJ (home)', '☀️ 58°F, sunny, winds WSW 9mph, high ~65°F'),
    ('Tuckerton, NJ (TLC yard)', '☀️ 63°F, clear, winds NE 7mph, high ~68°F'),
    ('Chesterfield, NJ (firehouse)', '☀️ 56°F, clear, calm winds, high ~66°F'),
    ('Columbia, SC (Bella)', '☁️ 60°F, overcast, light wind, high ~72°F'),
    ('Tuscaloosa, AL (Jules)', '☁️ 69°F, cloudy, S wind 5mph, high ~83°F'),
    ('Austin, TX (sentimental)', '⛅ 72°F, partly cloudy, S wind 6mph, high ~85°F'),
]

for loc, wx in weather_data:
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(2)
    p.paragraph_format.left_indent = Cm(0.5)
    run = p.add_run(f'{loc}:  ')
    run.bold = True
    run.font.size = Pt(10)
    run.font.name = 'Calibri'
    run2 = p.add_run(wx)
    run2.font.size = Pt(10)
    run2.font.name = 'Calibri'

p = doc.add_paragraph()
run = p.add_run('⚡ Beautiful Easter Saturday across all locations. NJ sunny and mild. Charleston nice for the family.')
run.font.size = Pt(9)
run.font.color.rgb = GRAY
run.font.italic = True

add_gold_line()

# === SECTION 2: MARKETS ===
add_heading_styled('§2 — MARKETS & INVESTMENTS', level=2)

add_body('Markets CLOSED Friday (Good Friday) and Saturday/Sunday. Reopen Monday April 6.')

add_sub_heading('Last Close (Thursday April 3)')
p = doc.add_paragraph()
p.paragraph_format.left_indent = Cm(0.5)
run = p.add_run('S&P 500: 6,582.69 ')
run.bold = True
run.font.size = Pt(10)
run = p.add_run('(−0.14% vs your exit at 6,591.90) — ')
run.font.size = Pt(10)
run = p.add_run('YOU\'RE WINNING')
run.bold = True
run.font.color.rgb = RGBColor(0x00, 0x80, 0x00)
run.font.size = Pt(10)

p = doc.add_paragraph()
p.paragraph_format.left_indent = Cm(0.5)
run = p.add_run('Dow Jones: 46,504.67 ')
run.bold = True
run.font.size = Pt(10)
run = p.add_run('(+0.16% vs your exit at 46,429.49) — ')
run.font.size = Pt(10)
run = p.add_run('SLIGHTLY ABOVE EXIT')
run.font.size = Pt(10)
run.font.color.rgb = RGBColor(0xCC, 0x66, 0x00)

add_sub_heading('Key Context')
add_body('• Strong March jobs report released Apr 3 — Fed rate cut bets fading\n• S&P recovered from sharp early losses to close slightly higher heading into long weekend\n• Iran/oil tensions subsiding — markets recovered from April 2 rout\n• Your treasury position continues earning ~$250/day while you wait\n• 26 days to April 30 portfolio execution')

add_sub_heading('13F / Super Investor Activity')
add_body('No new 13F filings due this cycle (next wave mid-May for Q1 2026). Continue monitoring Berkshire, Li Lu, Pabrai positions.')

add_sub_heading('Earnings This Week')
add_body('Quiet week (holiday-shortened). Nothing material from your watchlist until mid-April bank earnings season.')

add_gold_line()

# === SECTION 3: COMMODITIES ===
add_heading_styled('§3 — COMMODITY PRICES', level=2)

p = doc.add_paragraph()
p.paragraph_format.left_indent = Cm(0.5)
run = p.add_run('Lumber Futures (CME): ~$596/MBF ')
run.bold = True
run.font.size = Pt(10)
run = p.add_run('— flat, range-bound ($450–$712 since Aug 2022)')
run.font.size = Pt(10)

add_body('• Framing lumber up for 2nd consecutive quarter — positive for TLC margins\n• Treated/decking prices "making a leap" — goldmine season ahead\n• Canadian lumber duties at ~45% — supports domestic pricing\n• Plywood steady, no major moves\n• Spring building season ramping — demand should push prices toward upper range')

p = doc.add_paragraph()
run = p.add_run('💡 TLC Opportunity: Residential walk-in margins should push 35–40% on decking/treated lumber this spring.')
run.font.size = Pt(9)
run.font.color.rgb = GOLD
run.font.italic = True

add_gold_line()

# === SECTION 4: LOCAL NEWS ===
add_heading_styled('§4 — LOCAL NEWS & ZONING', level=2)

add_sub_heading('LBI / Ocean County')
add_body('• Ship Bottom seeking funding to protect borough beaches (SandPaper, Apr 2)\n• Tony Shalhoub to add star power to LBI Film Festival (SandPaper, Apr 3)\n• Athletic Director Chuck Donohue Jr. leaving Southern Regional in July\n• McCooley suspended as Pinelands Regional School District Superintendent\n• Beach Haven mayor honors Meals on Wheels\n• Bald eagle nests in NJ experience slight decline')

add_sub_heading('Chesterfield Township')
add_body('No new zoning board or planning board activity posted this week. Firehouse project (18 New St) — architect meeting with Brad scheduled for Wednesday April 8 at 10:15 AM.')

add_sub_heading('Construction Industry')
add_body('• Spring season officially underway — contractor activity picking up\n• NJ building permits trending steady; housing starts nationally flat\n• Credit card surcharge module (Amanda) — follow up when back from Charleston')

add_gold_line()

# === SECTION 5: TODAY'S SCHEDULE ===
add_heading_styled('§5 — TODAY\'S SCHEDULE', level=2)

add_sub_heading('Saturday, April 4')
add_body('☀️ ENJOY CHARLESTON WITH THE FAMILY\n• Easter Saturday — no business obligations\n• Daily Mission Tasks run at 8 AM (automated)\n• Gmail monitoring running every 2 minutes (automated)')

add_sub_heading('Upcoming This Week')
add_body('• Mon Apr 6, 7:30 AM — Transfer money into JLKL for PMK check\n• Mon Apr 6, 8:00 AM — Text Gabe McCabe (15 min late, New St plan)\n• Mon Apr 6 — Markets reopen\n• Mon Apr 6, 9:00 AM — Switch back to Claude Sonnet reminder\n• Wed Apr 8, 10:15 AM — Architect meeting with Brad at firehouse (18 New St)')

add_gold_line()

# === SECTION 6: ACTION CARD ===
add_heading_styled('§6 — ACTION CARD', level=2)

add_sub_heading('Mac / Tech')
add_checkbox('Compare API key monthly spend vs $200 Claude Max subscription')
add_checkbox('Set up Bella with her own OpenClaw instance')

add_sub_heading('Calls to Make')
add_checkbox('Text Gabe McCabe re: New Street plan (Monday)')
add_checkbox('Follow up with Amanda on Epicor credit card surcharge module')
add_checkbox('Reach out to Frank Capecci (973-229-9362) — condolences overdue')
add_checkbox('Follow up with Robert MacArthur on Roth conversion / W-2 restructuring')

add_sub_heading('Firehouse (18 New St)')
add_checkbox('Architect meeting with Brad — Wednesday April 8 at 10:15 AM')
add_checkbox('Bring floor plan markups to meeting')
add_checkbox('Decision: cancel redevelopment plan vs. proceed with luxury single-family conversion')

add_sub_heading('TLC / Surfbox')
add_checkbox('Surfbox social media program — April 30 go-live target (26 days)')
add_checkbox('Spring pricing strategy execution — residential walk-in margins to 35–40%')
add_checkbox('Surfbox-TLC cross-sell program implementation (counter flyers, cashier scripts)')
add_checkbox('Follow up on concrete drain installation — target pre-Easter completion')

add_sub_heading('Properties')
add_checkbox('Corner Market deal evaluation (275 W 9th St, Ship Bottom)')
add_checkbox('Property tax challenge — Chesterfield parcels (Block 301, Lots 10 & 12)')

add_sub_heading('Family / Personal')
add_checkbox('Transfer JLKL for PMK check (Monday)')
add_checkbox('Pay Gio $225 cash for driveway work at parents\' house')
add_checkbox('Jules summer confidence project — waitressing job at beach?')
add_checkbox('Keli — enjoy Charleston, put phone down, be present')

add_sub_heading('Errands')
add_checkbox('(None scheduled — enjoy the holiday weekend)')

add_sub_heading('Coming Up This Week')
add_checkbox('April 30 portfolio execution — 26 days out, finalize strike list')
add_checkbox('Surfbox social media go-live countdown')
add_checkbox('Bank earnings season mid-April — monitor for watchlist movers')

add_gold_line()

# === SECTION 7: SPORTS ===
add_heading_styled('§7 — SPORTS', level=2)

add_sub_heading('MLB — Friday April 3 (Opening Week)')
add_body('⚾ Yankees 8, Marlins 2 — HOME OPENER W! Aaron Judge 2-run HR in the 1st. Will Warren (1-0) dominant. Yankees 6-1, BEST IN AL EAST.\n⚾ Phillies 10, Rockies 1 — Nola (1-0) sharp. Schwarber solo HR. Phillies 4-3.\n⚾ Full slate of 15 games played across MLB.')

add_sub_heading('NBA — Friday April 3')
add_body('🏀 Knicks 136, Bulls 96 — BLOWOUT. OG Anunoby 31 pts, Robinson 17/11. Led by 47 at one point. Knicks 50-28, rolling into playoffs.')

add_sub_heading('NFL')
add_body('🏈 Offseason. Draft April 23–25.')

add_sub_heading('USMNT')
add_body('⚽ USMNT played Belgium in friendly (Apr 2, Atlanta). World Cup 2026 buildup continues.')

add_sub_heading('Liverpool FC')
add_body('⚽ Man City vs Liverpool TODAY (Apr 4) — big Premier League match. Recent form: Brighton 2-1 Liverpool (L), Liverpool 4-0 Galatasaray (W in CL).')

add_gold_line()

# === SECTION 8: TOKEN SPEND ===
add_heading_styled('§8 — TOKEN SPEND', level=2)

add_body('📊 Claude Max subscription: $200/month flat rate (switched March 29)\n• Yesterday\'s usage: Included in subscription — no per-token charges\n• April running total: $200 flat (no overages)\n• Previous API spend was tracking ~$150–250/month variable\n• Net savings: Predictable billing, unlimited usage within fair-use limits')

add_gold_line()

# === FOOTER ===
footer = doc.add_paragraph()
footer.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = footer.add_run('\n🦞 Prepared by Rob Lobster  •  Saturday April 4, 2026 at 8:00 AM ET\n"Make good decisions." — Robby')
run.font.size = Pt(8)
run.font.color.rgb = GRAY
run.font.italic = True

# === SAVE ===
output_dir = '/Users/joemac/.openclaw/workspace/projects/daily'
os.makedirs(output_dir, exist_ok=True)
output_path = os.path.join(output_dir, 'morning-joes-rundown-2026-04-04.docx')
doc.save(output_path)
print(f'Saved: {output_path}')
