# tradedangerous/commands/update_cmd.py — DEPRECATED (no-op)
# This command no longer edits station price lists directly.
#
# How to maintain price/station data going forward:
#   • Import authoritative data via:   trade import -P spansh  |  trade import -P eddblink
#   • Solo/offline players (manual capture via EDMC plugin):
#       TradeDangerous DB-Update for EDMC → https://github.com/bgol/UpdateTD
#
# This module accepts and ignores any arguments/switches and exits immediately.

from __future__ import annotations
from .parsing import ParseArgument

# ---- Command metadata ----
help = "DEPRECATED: no longer used. See deprecation banner when run."
name = "update"
epilog = None

# Swallow unknown switches/args (loader must honor this flag).
acceptUnknown = True

# No DB access is needed for this no-op command.
wantsTradeDB = False
usesTradeData = False

# Accept ANY number of positional args and ignore them (prevents parser errors).
arguments = (
    ParseArgument(
        "args",
        help="(deprecated) ignored",
        nargs="*",
        type=str,
    ),
)
# No switches; unknown switches will be ignored via acceptUnknown.
switches = tuple()


def _banner() -> str:
    return (
        "\n"
        "=== DEPRECATION NOTICE: update =====================================\n"
        "This command no longer edits station price lists and does not modify the DB.\n"
        "• Import data via:               trade import -P eddblink | -P spansh\n"
        "• Solo/offline capture via EDMC: TradeDangerous DB-Update → https://github.com/bgol/UpdateTD\n"
        "=====================================================================\n"
    )


def run(results, cmdenv, tdb=None):
    """
    No-op implementation: print banner and exit immediately.
    All arguments/switches are ignored by design.
    """
    banner = _banner()
    try:
        cmdenv.NOTE("{}", banner)
    except Exception:
        print(banner)
    return None


def render(results, cmdenv, tdb=None):
    # No output beyond the banner emitted in run().
    return
