import sys
import os
import tkinter as tk
from tkinter import ttk

# Ajusta la ruta si fuera necesario:
# sys.path.append("C:\\Users\\pedro\\Desktop\\Projects\\source\\src")

from tabs.tab_simulator import TabSimulator
from tabs.tab_search import TabSearch
from tabs.tab_drag import TabDrag
from tabs.tab_coil import TabCoil
from tabs.tab_power import TabPower

class MainApp:
    def __init__(self, master):
        self.master = master
        self.master.title("LaunchSim")
        icon_path = os.path.join(os.path.dirname(__file__), "static", "icon.ico")
        if os.path.exists(icon_path):
            self.master.iconbitmap(icon_path)
        else:
            print(f"Advertencia: Icono no encontrado en {icon_path}")

        self.notebook = ttk.Notebook(master)
        self.notebook.pack(fill="both", expand=True)

        # Pestaña 1: Simulador
        self.tab_sim = TabSimulator(self.notebook)
        self.notebook.add(self.tab_sim.frame, text="Simulador Trayectoria")

        # Pestaña 2: Rozamiento
        self.tab_drag = TabDrag(self.notebook, self.tab_sim)
        self.notebook.add(self.tab_drag.frame, text="Rozamiento")

        # Pestaña 3: Optimización
        self.tab_search = TabSearch(self.notebook, self.tab_sim)
        self.notebook.add(self.tab_search.frame, text="Optimización")

        # Pestaña 4: Bobinas
        self.tab_coil = TabCoil(self.notebook, self.tab_sim)
        self.notebook.add(self.tab_coil.frame, text="Bobinas")

        # Pestaña 5: Nuevo TabPower
        self.tab_power = TabPower(self.notebook, self.tab_coil, self.tab_sim)
        self.notebook.add(self.tab_power.frame, text="Dimensionamiento eléctrico")

if __name__ == "__main__":
    root = tk.Tk()
    app = MainApp(root)
    root.mainloop()
