"""opentranscode — open-source batch video transcoder (av1an + ffmpeg).

A PySide6 GUI application that orchestrates av1an + ffmpeg for batch video
transcoding. Distro-aware, config-driven (codec / audio / container /
resolution / license profiles), with a QThread-based encoder worker, a
from-git source builder for resolving VapourSynth / av1an ABI mismatches,
and a retro-futuristic media-console UI.

This package is a pure code-organization refactor of the single-file
``open-transcode.v3.py`` script (QA item v4-03). Behavior is identical to
v3; the v3 script is preserved alongside this package for test-back-compat.

Run as a module:
    python -m opentranscode            # launch the GUI
    python -m opentranscode --version  # print version and exit
    python -m opentranscode --dry-run  # probe env + smoke test, no GUI
    python -m opentranscode --verify-only /path/to/output.mkv

Or import in code:
    import opentranscode
    print(opentranscode.__version__)
"""

from __future__ import annotations

__version__ = "3.2.0"
__author__ = "Jeremy Anderson - dcos.net"
__license__ = "AGPL-3.0"

__all__ = [
    "__version__",
    "__author__",
    "__license__",
    "build_parser",
    "main",
    "launch_gui",
]

# Lightweight re-exports for convenience. Heavy modules (env_probe,
# encoder_worker, ui_window) are NOT imported here so that
# ``import opentranscode`` works without PySide6 being available — this
# keeps ``opentranscode.__version__`` cheap and side-effect-free for
# ``--version`` and for tooling that just wants the metadata.
from .cli import build_parser, main


def launch_gui(argv: list[str] | None = None, force: bool = False) -> int:
    """Launch the OpenTranscode GUI.

    Thin wrapper around ``opentranscode.ui_window.launch_gui``; imported
    lazily so that ``import opentranscode`` does not pull in PySide6.

    v5-01: *force* pre-checks the "Force (skip validation)" checkbox.
    """
    from .ui_window import launch_gui as _launch
    return _launch(argv, force=force)
