import typer
from typing_extensions import Annotated

from texmemo.uploader import Uploader
from texmemo.types import DuplicateBehaviour

app = typer.Typer()


def upload(
    input: Annotated[str, typer.Argument(
        help="Path to input .csv file"
    )],
    deck_name: Annotated[str, typer.Argument(
        help="The name of the Anki deck to upload to"
    )],
    model_name: Annotated[str, typer.Option(
        "--model-name", "-m", help="The name of the Anki card model"
    )] = "Basic",
    duplicates: Annotated[DuplicateBehaviour, typer.Option(
        "--duplicates", "-d", help="Behaviour for cards existing in Anki already."
    )] = DuplicateBehaviour.REPLACE
):
    uploader = Uploader(input, deck_name, model_name, duplicates)
    uploader.upload_from_file()
