# dashboard.py
import streamlit as st
import matplotlib.pyplot as plt
from main import start_sim, stop_sim, reset_sim, bess_soc_since_start

# Header
st.logo("https://rooftop.my/logo.svg", size="large")
st.title("MEOS Control Dashboard")
st.subheader("Mobile Energy Operations Simulation (MEOS)")
st.text("Run MEOS Simulation and Monitor MBESS Status")

# some instructions

# --- SESSION STATE SETUP ---
if "running" not in st.session_state:
    st.session_state.running = False
if "plot_area" not in st.session_state:
    st.session_state.plot_area = st.empty()

# --- CONTROL BUTTONS ---
col1, col2, col3 = st.columns(3)
with col1:
    if st.button("Start", use_container_width=True):
        start_sim()
        st.session_state.running = True
with col2:
    if st.button("Stop", use_container_width=True):
        stop_sim()
        st.session_state.running = False
with col3:
    if st.button("Reset", use_container_width=True):
        reset_sim()
        st.session_state.running = False
