
import argparse 

from .config import YOLO26_MODELS 
from .yolo_scanner import start_scanner as start_yolo ,detect_objects 
from .scanner import start_interactive_capture as start_ollama 

def main ():
    parser =argparse .ArgumentParser (
    description ="Ollama and YOLO Logo Detection Scanner"
    )

    parser .add_argument ("--model","-m",type =str )
    parser .add_argument ("--size","-s",type =str ,default ="nano",
    choices =["nano","small","medium","large","xlarge"])
    parser .add_argument ("--logo-model",type =str )
    parser .add_argument ("--yolo",action ="store_true")
    parser .add_argument ("--no-gui",action ="store_true")
    parser .add_argument ("--track","-t",action ="store_true")
    parser .add_argument ("--hybrid",action ="store_true")
    parser .add_argument ("--image","-i",type =str )

    args =parser .parse_args ()

    if args .image :
        detections =detect_objects (
        args .image ,model_size =args .size ,hybrid_mode =args .hybrid 
        )
        print (f"Found {len (detections )} detections:")
        for det in detections :
            print (f"   {det ['label']}: {det ['confidence']:.2%}")

    elif args .yolo :
        start_yolo (
        model_path =args .model ,
        model_size =args .size ,
        logo_model_path =args .logo_model ,
        use_gui =not args .no_gui ,
        use_tracking =args .track ,
        hybrid_mode =args .hybrid 
        )

    else :
        start_ollama ()

if __name__ =="__main__":
    main ()
