from tkinter import *
from tkinter import ttk
from functions.clean import clean_data
from functions.load import load_data
from functions.manipulate import manipulate_values
from functions.statistics import calculate_statistics
from functions.visualise import generate_output_and_visualizations
from functions.convert import save_as_json
from functions.convert import save_as_xml
from functions.backup_restore import backup_to_mongodb
from functions.backup_restore import restore_from_mongodb
from ui.frames import initialize_frames as data_frame
from ui.frames import initialize_frames as dataset_frame

def initialize_buttons(frame):
    # Create buttons for each option
    load_data_button = ttk.Button(frame, text="Load dataset", command=load_data)
    load_data_button.grid(row=0, column=0, sticky='w', padx=5, pady=5)

    clean_data_button = ttk.Button(frame, text="Clean dataset", command=clean_data)
    clean_data_button.grid(row=1, column=0, sticky='w', padx=5, pady=5)

    load_and_save_button = ttk.Button(frame, text="Load and save prepared data", command=load_data, state='disabled')
    load_and_save_button.grid(row=2, column=0, sticky='w', padx=5, pady=5)

    generate_output_button = ttk.Button(frame, text="Generate output and visualizations", command=generate_output_and_visualizations, state='disabled')
    generate_output_button.grid(row=3, column=0, sticky='w', padx=5, pady=5)

    manipulate_values_button = ttk.Button(frame, text="Manipulate values", command=manipulate_values, state='disabled')
    manipulate_values_button.grid(row=4, column=0, sticky='w', padx=5, pady=5)

    # Create quit button
    quit_button = ttk.Button(frame.master, text="Quit", command=frame.master.destroy)
    quit_button.grid(row=5, column=0, sticky='w', padx=5, pady=5)
