#!/usr/bin/env python
import rospy
from rich.console import Console

rospy.init_node("receptionist_service_checker", anonymous=True)

# wait for all required services:
rospy.wait_for_service('/yolov8/detect')
rospy.wait_for_service('/bodypix/detect')
rospy.wait_for_service('/deepface/detect')
rospy.wait_for_service('/torch/detect/face_features')
rospy.wait_for_service('/lasr_rasa/parse')
rospy.wait_for_service('/database/vectors/receptionist/create_collection')

# wait for any additional topics we expect:
# while True:
#     topics = rospy.get_published_topics()
#     if '/tts/goal' in topics:
#         break

#     rospy.sleep(0.2)

console = Console()
with console.screen():
    console.print("\n[bold purple]Receptionist Task[/bold purple]\nAll services are [green]ready[/green]!\n[bright_black]You can start the task now by running:\nrosrun bsc_receptionist task")
    # wait for task to start, then release the screen
    rospy.spin()
