import streamlit as st
from streamlit_extras.switch_page_button import switch_page
from st_pages import Page, show_pages, hide_pages


# Create an empty container
placeholder = st.empty()

actual_email = "email"
actual_password = "password"

# Insert a form in the container
with placeholder.form("login"):
    st.markdown("#### Enter your credentials")
    email = st.text_input("Email")
    password = st.text_input("Password", type="password")
    submit = st.form_submit_button("Login")

if submit and email == actual_email and password == actual_password:
    # If the form is submitted and the email and password are correct,
    # clear the form/container and display a success message
    placeholder.empty()
    st.success("Login successful")
    show_pages([
    Page("Home.py","Home"),
    Page("login.py","login"),
    #Page("export_data.py","Annual Finance Performance"),
    #Page("pie_diagram.py","Income-Expenses"),
    #Page("select_income.py","Detailed Analys income"),
    Page("criteria_new.py","Financal KPI")
])


#hide_pages(['export_data']),
#hide_pages(['pie_diagram']),
#hide_pages(['select_income']),
#hide_pages(['criteria_new'])
    hide_pages([
        #Page("Home.py","Home"),
        #Page("login.py","login"),
        Page("export_data.py","Annual Finance Performance"),
        Page("pie_diagram.py","Income-Expenses"),
        Page("select_income.py","Detailed Analys income"),
        Page("criteria_new.py","Financal KPI")
    ])
        #if st.button('login'):
            #switch_page('login')
    #if st.button('Financal KPI'):
        #switch_page('criteria_new')
    URL_STRING = "criteria_new"

    st.markdown(
        f'<a href="{URL_STRING}" style="display: inline-block; padding: 12px 20px; background-color: #4CAF50; color: white; text-align: center; text-decoration: none; font-size: 16px; border-radius: 4px;">Action Text on Button</a>',
        unsafe_allow_html=True
        )
    

elif submit and email != actual_email and password != actual_password:
    st.error("Login failed")
else:
    pass