import json

def get_user_input(prompt):
    """Get input from the user."""
    return input(prompt)

def refine_axis(axis, feedback):
    """Refine the axis based on user feedback."""
    return axis + " " + feedback if feedback else axis

def main():
    print("\nWelcome to the Job Hunting Axis Creator!\n")

    axis = ""

    for i in range(3):
        print(f"Round {i+1} of conversation:\n")
        question = "What is important to you when choosing a company?\n"
        user_response = get_user_input(question)

        print("\nThank you for sharing! Based on this, your axis so far is:")
        axis = refine_axis(axis, user_response)
        print(f"\t{axis}\n")

        additional_feedback = get_user_input("Do you have any additional feedback or considerations? (If none, press Enter)\n")
        if additional_feedback:
            axis = refine_axis(axis, additional_feedback)

    print("\nYour final job hunting axis is:")
    print(f"\t{axis}\n")

    save_axis = get_user_input("Would you like to save this axis to a file? (yes/no)\n").strip().lower()
    if save_axis == "yes":
        file_name = get_user_input("Enter the file name (e.g., axis.json):\n").strip()
        with open(file_name, "w") as file:
            json.dump({"job_hunting_axis": axis}, file, indent=4)
        print(f"Your axis has been saved to {file_name}.\n")
    else:
        print("Your axis has not been saved.\n")

if __name__ == "__main__":
    main()
