"""Lab 11: a text menu for adopting pets at the shelter.

Author: YOUR NAME
Version: THE DATE
"""

import shelter as sh
from shelter_data import SHELTER

MENU = """
1. See the pets waiting for a home
2. Find a match
3. Adopt a pet
0. Exit"""


def main() -> None:
    """Run the kiosk until the user chooses 0."""
    print(f"Welcome to {SHELTER['name']}!")

    choice = ""
    while choice != "0":
        print(MENU)
        choice = input("Choose an option: ")

        if choice == "1":
            pass  # TODO: Step 5

        elif choice == "2":
            pass  # TODO: Step 6

        elif choice == "3":
            name = input("Pet's name? ").strip().title()
            adopter = input("Your name? ").strip()
            if sh.adopt(SHELTER, name, adopter):
                print(f"Congratulations, {adopter}! {name} is going home with you.")
            else:
                print(f"Sorry, {name} isn't available.")

        elif choice != "0":
            print(f"{choice} isn't an option. Try again.")

    print(f"Goodbye! {len(sh.available(SHELTER))} pets are still waiting for a home.")


if __name__ == "__main__":
    main()
