#!/usr/bin/env python3
"""Convert the Wheel of Wellness proposal to a polished DOCX."""

from docx import Document
from docx.shared import Pt, Inches, Cm, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

# ── Colors ──────────────────────────────────────────────────
TEAL       = '2E7D6F'
CORAL      = 'E8835C'
DARK       = '2D3436'
CREAM      = 'FFF8F0'
LIGHT_TEAL = 'E8F5F1'
ALT_ROW    = 'F7F7F7'
WHITE      = 'FFFFFF'

# ── Helpers ─────────────────────────────────────────────────
def set_cell_shading(cell, color):
    shading = OxmlElement('w:shd')
    shading.set(qn('w:fill'), color)
    shading.set(qn('w:val'), 'clear')
    cell._tc.get_or_add_tcPr().append(shading)

def styled_table(doc, headers, rows, col_widths=None):
    """Create a bordered table with teal header, alternating row shading."""
    t = doc.add_table(rows=1 + len(rows), cols=len(headers))
    t.alignment = WD_TABLE_ALIGNMENT.CENTER
    t.style = 'Table Grid'
    # Header
    for i, h in enumerate(headers):
        cell = t.rows[0].cells[i]
        cell.text = ''
        p = cell.paragraphs[0]
        run = p.add_run(h)
        run.bold = True
        run.font.size = Pt(10)
        run.font.color.rgb = RGBColor(255, 255, 255)
        set_cell_shading(cell, TEAL)
    # Data rows
    for ri, row_data in enumerate(rows):
        for ci, val in enumerate(row_data):
            cell = t.rows[ri + 1].cells[ci]
            cell.text = ''
            p = cell.paragraphs[0]
            run = p.add_run(str(val))
            run.font.size = Pt(10)
            run.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
            if ri % 2 == 1:
                set_cell_shading(cell, ALT_ROW)
    # Column widths
    if col_widths:
        for i, w in enumerate(col_widths):
            for row in t.rows:
                row.cells[i].width = Cm(w)
    doc.add_paragraph()  # spacer
    return t

def add_heading(doc, text, level=1):
    h = doc.add_heading(text, level=level)
    for run in h.runs:
        run.font.color.rgb = RGBColor(*bytes.fromhex(TEAL))
    return h

def add_body(doc, text, bold_prefix=None):
    p = doc.add_paragraph()
    if bold_prefix:
        r = p.add_run(bold_prefix)
        r.bold = True
        r.font.size = Pt(11)
        r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    r = p.add_run(text)
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    return p

def add_bullet(doc, text, bold_prefix=None):
    p = doc.add_paragraph(style='List Bullet')
    if bold_prefix:
        r = p.add_run(bold_prefix)
        r.bold = True
        r.font.size = Pt(11)
        r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    r = p.add_run(text)
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    return p

def add_numbered(doc, text, bold_prefix=None):
    p = doc.add_paragraph(style='List Number')
    if bold_prefix:
        r = p.add_run(bold_prefix)
        r.bold = True
        r.font.size = Pt(11)
    r = p.add_run(text)
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    return p

def add_callout(doc, text, prefix=None):
    """Indented italic callout paragraph."""
    p = doc.add_paragraph()
    pf = p.paragraph_format
    pf.left_indent = Cm(1)
    if prefix:
        r = p.add_run(prefix)
        r.bold = True
        r.italic = True
        r.font.size = Pt(11)
        r.font.color.rgb = RGBColor(*bytes.fromhex(CORAL))
    r = p.add_run(text)
    r.italic = True
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex('555555'))
    return p

# ── Document ────────────────────────────────────────────────
doc = Document()

# Page margins
for section in doc.sections:
    section.top_margin = Cm(2.54)
    section.bottom_margin = Cm(2.54)
    section.left_margin = Cm(2.54)
    section.right_margin = Cm(2.54)

# ── Title Page ──────────────────────────────────────────────
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
pf = p.paragraph_format
pf.space_before = Pt(72)
r = p.add_run('Wheel of Wellness\nResource Connector')
r.bold = True
r.font.size = Pt(32)
r.font.color.rgb = RGBColor(*bytes.fromhex(TEAL))

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = p.add_run('A Proposal for HELPipedia / SpecialNeeds.help')
r.font.size = Pt(16)
r.font.color.rgb = RGBColor(*bytes.fromhex(CORAL))

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
pf = p.paragraph_format
pf.space_before = Pt(36)
for line in [
    'Prepared by: Kayla Newkirk, M.S.Ed., MHC-LP',
    'Doctoral Candidate, Counselor Education & Supervision',
    'Waynesburg University',
    '',
    'Meeting with: Phil Vetrano, MBA',
    'President & Co-founder, HELPipedia',
    '',
    'Week of June 16, 2026',
]:
    r = p.add_run(line + '\n')
    r.font.size = Pt(12)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))

doc.add_page_break()

# ── Executive Summary ───────────────────────────────────────
add_heading(doc, 'Executive Summary', level=1)
add_body(doc, 'HELPipedia already connects families to resources through SpecialNeeds.help. The next step is making that connection proactive and personalized. Instead of asking families to browse a directory, we meet them where they are with a Wheel of Wellness assessment that identifies their needs across six dimensions and automatically surfaces the most relevant resources.')
add_body(doc, '')
add_body(doc, 'This builds on the existing Family Wheel of Life assessment (ScoreApp) and the Caregiver Wellness Wheel framework developed for the ADA 36th Anniversary Telethon.')
add_callout(doc, ' Approve a pilot project to design, build, and test an interactive Wheel of Wellness assessment tool integrated into the HELPipedia / SpecialNeeds.help ecosystem.', prefix='The ask:')

doc.add_page_break()

# ── Section 1: The Problem ──────────────────────────────────
add_heading(doc, '1. The Problem We Are Solving', level=1)
styled_table(doc,
    ['Current Experience', 'Proposed Experience'],
    [
        ['Family arrives at SpecialNeeds.help', 'Family arrives at SpecialNeeds.help'],
        ['Browses categories or searches keywords', 'Takes a 5-minute wellness needs assessment'],
        ['Must already know what they need', 'Assessment identifies needs they may not have named'],
        ['Finds resources one at a time', 'Receives a personalized resource map across all relevant dimensions'],
        ['Leaves with a link', 'Leaves with a plan and a connection'],
    ],
    col_widths=[8.5, 8.5],
)
add_callout(doc, 'Families navigating disability and caregiving often do not know what they need until someone asks the right questions. A directory is powerful when you know what to search for. An assessment tool is powerful when you do not.', prefix='The gap: ')

# ── Section 2: What We Are Proposing ────────────────────────
add_heading(doc, '2. What We Are Proposing', level=1)

add_heading(doc, 'The Tool', level=2)
add_body(doc, 'An interactive, web-based Wheel of Wellness Assessment that:')
add_numbered(doc, 'Asks caregivers and individuals with disabilities targeted questions across six wellness dimensions')
add_numbered(doc, 'Scores each dimension to identify strengths and areas of need')
add_numbered(doc, 'Generates a personalized results page that maps their specific needs to resources in the SpecialNeeds.help directory')
add_numbered(doc, 'Optionally connects them to a coach, mentor, or support group')

add_heading(doc, 'The Six Dimensions', level=2)
add_body(doc, 'Adapted from the Myers, Sweeney, and Witmer (1998) Wheel of Wellness model and tailored for the caregiver and disability community:')
styled_table(doc,
    ['Dimension', 'Core Question', 'Example Resource Connections'],
    [
        ['Physical', 'Are basic health, rest, and movement needs being met?', 'Respite care, medical providers, adaptive recreation, sleep support'],
        ['Emotional', 'Is there space to name and cope with feelings?', 'Counseling referrals, caregiver support groups, crisis lines'],
        ['Social', 'Is there a community that understands?', 'Parent mentors, local support networks, community events, peer matching'],
        ['Practical', 'Are logistics, advocacy, and systems manageable?', 'IEP advocates, legal aid, financial assistance, benefits navigation'],
        ['Purpose', 'Is there meaning and identity beyond caregiving?', 'Faith communities, disability-affirming organizations, storytelling platforms'],
        ['Growth', 'Is there room to learn, create, and become?', 'Training, conferences, podcasts, creative programs, continuing education'],
    ],
    col_widths=[3, 5.5, 8.5],
)

add_heading(doc, 'How It Differs from the Existing Family Wheel of Life', level=2)
styled_table(doc,
    ['Feature', 'Family Wheel of Life (Current)', 'Wheel of Wellness Connector (Proposed)'],
    [
        ['Focus', 'General family balance', 'Caregiver and disability-specific needs'],
        ['Dimensions', '4 (Health, Home, Connection, Joy)', '6 (Physical, Emotional, Social, Practical, Purpose, Growth)'],
        ['Output', 'Personalized report with general guidance', 'Personalized resource map linked to SpecialNeeds.help'],
        ['Action step', 'Self-reflection', 'Direct connection to services, providers, and support'],
        ['Audience', 'Broad families', 'Caregivers, parents of children with disabilities, individuals with disabilities'],
        ['Clinical grounding', 'Life coaching framework', 'Counseling wellness model (Myers, Sweeney, & Witmer, 1998)'],
    ],
    col_widths=[3.5, 6, 7.5],
)
add_body(doc, 'The two tools serve different audiences and can coexist. The Wheel of Wellness Connector targets the specific population HELPipedia and SpecialNeeds.help are built to serve.')

doc.add_page_break()

# ── Section 3: Why This Matters ─────────────────────────────
add_heading(doc, '3. Why This Matters for HELPipedia', level=1)

add_heading(doc, 'Strategic Alignment', level=2)
add_bullet(doc, '"Help parents and youth bridge the gap between knowledge and opportunity." The assessment literally bridges that gap by turning knowledge of needs into opportunity for connection.', bold_prefix='Mission: ')
add_bullet(doc, 'A personalized entry point increases engagement, return visits, and directory utilization.', bold_prefix='SpecialNeeds.help adoption: ')
add_bullet(doc, 'Aggregated (anonymous) assessment data reveals what the community needs most, informing content development, partnerships, and fundraising.', bold_prefix='Data and insight: ')
add_bullet(doc, 'No other major disability resource directory offers a clinically grounded, personalized needs assessment with automatic resource matching.', bold_prefix='Differentiator: ')

doc.add_page_break()

# ── Section 4: Resource Requirements ────────────────────────
add_heading(doc, '4. Resource Requirements', level=1)

add_heading(doc, 'What Kayla Provides', level=2)
for item in [
    'Clinical expertise in wellness models and counseling frameworks',
    'Assessment design, question writing, and scoring methodology',
    'Content for results pages (wellness guidance, psychoeducation, resource explanations)',
    'User testing coordination with caregiver and disability community',
    'Ongoing clinical review as tool evolves',
]:
    add_bullet(doc, item)

add_heading(doc, 'What HELPipedia Provides', level=2)
for item in [
    'Platform access and technical implementation',
    'Integration with SpecialNeeds.help directory',
    'Marketing and community outreach (Chris Myers)',
    'Analytics and data tracking',
    'Board approval and strategic support',
]:
    add_bullet(doc, item)



doc.add_page_break()

# ── Section 5: Success Metrics ──────────────────────────────
add_heading(doc, '5. Success Metrics', level=1)
styled_table(doc,
    ['Metric', 'Target (First 90 Days)'],
    [
        ['Assessment completions', '100+'],
        ['Completion rate (started vs. finished)', '70%+'],
        ['Resource link clicks from results page', '50%+ of completions'],
        ['Return visits to SpecialNeeds.help', '30%+ within 30 days'],
        ['Qualitative feedback', 'Positive sentiment from 80%+ of feedback respondents'],
        ['Community sharing', 'Assessment shared by 10+ caregivers to their networks'],
    ],
    col_widths=[8, 9],
)

# ── Section 6: Sample User Journey ──────────────────────────
add_heading(doc, '6. Sample User Journey', level=1)
add_body(doc, 'She is a single mother of a 9-year-old with Down syndrome and a heart condition. She works full-time. She heard about SpecialNeeds.help from a friend.', bold_prefix='Meet Sarah. ')

steps = [
    '"Not sure where to start? Take 5 minutes to find the resources that fit your family."',
    'She clicks and begins the Wheel of Wellness assessment.',
    'She answers 20-25 short questions. Some are about her child. Some are about her.',
]
for i, s in enumerate(steps, 1):
    add_numbered(doc, s)

add_body(doc, 'Her results page shows:')
for dim, status, detail in [
    ('Physical: Needs Attention', '', '(she has not seen her own doctor in 18 months; her child needs a new cardiologist)'),
    ('Emotional: Moderate', '', '(she has a friend she talks to but no formal support)'),
    ('Social: Needs Attention', '', '(she moved recently and does not know anyone local)'),
    ('Practical: Strong', '', '(she has an IEP advocate and understands the system)'),
    ('Purpose: Moderate', '', '(she used to paint but stopped)'),
    ('Growth: Needs Attention', '', '(she wants to learn more about transition planning)'),
]:
    p = doc.add_paragraph(style='List Bullet')
    r = p.add_run(dim)
    r.bold = True
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))
    r = p.add_run(' ' + detail)
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))

add_numbered(doc, 'Under each dimension, she sees 2-3 specific resources from SpecialNeeds.help, with one-click links.')
add_numbered(doc, '"Want to talk to someone? Connect with a parent mentor." with a link to HELPipedia\'s community.')
add_numbered(doc, 'Sarah bookmarks her results. She shares the assessment with her sister, who is also a caregiver.')

add_callout(doc, 'Sarah did not have to know what to search for. The right questions led her to the right resources. That is the difference between a directory and a connector.', prefix='What happened: ')

doc.add_page_break()

# ── Section 7: References ───────────────────────────────────
add_heading(doc, '7. Background References', level=1)
refs = [
    'Myers, J. E., Sweeney, T. J., & Witmer, J. M. (1998). The Wheel of Wellness: A holistic model for treatment planning. Journal of Counseling & Development, 76(3), 251-263.',
    'Newkirk, K. (2026). Nourishing the Caregiver: The Wheel of Wellness for Special Needs Families. Presentation for HELPipedia ADA 36th Anniversary Telethon.',
    'HELPipedia Family Wheel of Life Assessment (ScoreApp). Retrieved from https://patrice-l7tf94gf.scoreapp.com/',
    'Americans with Disabilities Act of 1990, as amended. 42 U.S.C. 12101 et seq.',
]
for ref in refs:
    p = doc.add_paragraph(ref, style='List Bullet')
    for run in p.runs:
        run.font.size = Pt(10)

# ── Closing ─────────────────────────────────────────────────
doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = p.add_run('This proposal connects clinical wellness frameworks with practical resource delivery, giving HELPipedia a unique tool that no other disability resource directory currently offers. The infrastructure already exists. The expertise is available. The community needs it.')
r.italic = True
r.font.size = Pt(11)
r.font.color.rgb = RGBColor(*bytes.fromhex('555555'))

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
pf = p.paragraph_format
pf.space_before = Pt(24)
for line in [
    'Prepared by Kayla Newkirk, M.S.Ed., MHC-LP',
    'Doctoral Candidate, Counselor Education & Supervision, Waynesburg University',
    'kcordone30@gmail.com',
]:
    r = p.add_run(line + '\n')
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(*bytes.fromhex(DARK))

# ── Save ────────────────────────────────────────────────────
out = '/home/newkirk/Documents/Career/WheelOfWellnessProposal.docx'
doc.save(out)
print(f'Saved: {out}')
