# -*- mode: python ; coding: utf-8 -*-
# PyInstaller Spec for HAD Digital MVP - Single Standalone Executable (.exe)
# Bundles pure Python HTTP server, embedded SQLite engine, responsive HTML/CSS/JS frontend,
# and CTCAE rules into a zero-external-dependency Windows executable.

import sys
from pathlib import Path

block_cipher = None

# Analysis configuration
a = Analysis(
    ['MVP/app.py'],
    pathex=['MVP'],
    binaries=[],
    datas=[
        ('MVP/static', 'static'),
        ('MVP/guidance', 'guidance'),
        ('MVP/data/ctcae_rules.json', 'data'),
    ],
    hiddenimports=[
        'adapters',
        'adapters.base',
        'adapters.stub',
        'adapters.glm',
        'http.server',
        'sqlite3',
        'hashlib',
        'json',
        'uuid',
        'datetime',
        'urllib.parse',
        'threading',
        'secrets',
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[
        'tkinter',
        'matplotlib',
        'scipy',
        'numpy',
        'pandas',
        'openpyxl',
        'PIL',
        'pytest',
        'playwright',
        'boto3',
        'botocore',
        'torch',
        'unittest',
        'email',
        'xmlrpc',
    ],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
    optimize=1,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='HAD_Digital',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
