#!/usr/bin/env python3
"""Verschiebt eine Route in den Papierkorb."""

import argparse
from collections.abc import Sequence

from common import add_common_arguments, ask, client_from_args, confirm, run


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(description="Route weich löschen")
    add_common_arguments(parser)
    parser.add_argument("--route-id", type=int)
    return parser


def main(argv: Sequence[str] | None = None):
    args = build_parser().parse_args(argv)
    client = client_from_args(args)
    route_id = ask("Route-ID", args.route_id, required=True, cast=int)
    if not confirm(f"Route {route_id} in den Papierkorb verschieben?"):
        return {"cancelled": True}
    return client.request("DELETE", f"/api/routes/{route_id}")


if __name__ == "__main__":
    run(main)
