use crate::*;
use iced::Element;

pub fn settings(state: &State) -> Element<'_, Message> {
    empty()
}

pub fn update(_state: &mut SettingsState, message: SettingsMessage) -> Task<Message> {
    match message {
        SettingsMessage::Open => {}
        SettingsMessage::Close => {}
        SettingsMessage::Select(screen) => {
            tracing::trace!("Switching settings screen to {:?}", screen);
        }
    }
    Task::none()
}

pub fn empty() -> Element<'static, Message> {
    column([]).into()
}

#[derive(Debug, Clone, Default)]
pub struct SettingsState {
    login_form: LoginForm,
    server_form: ServerForm,
    screen: SettingsScreen,
}

#[derive(Debug, Clone)]
pub enum SettingsMessage {
    Open,
    Close,
    Select(SettingsScreen),
}

#[derive(Debug, Clone, Default)]
pub enum SettingsScreen {
    #[default]
    Main,
    Users,
    Servers,
}

#[derive(Debug, Clone)]
pub struct ServerItem {
    pub id: uuid::Uuid,
    pub name: SharedString,
    pub url: SharedString,
    pub users: Vec<uuid::Uuid>,
}

#[derive(Debug, Clone)]
pub struct UserItem {
    pub id: uuid::Uuid,
    pub name: SharedString,
}

#[derive(Debug, Clone, Default)]
pub struct LoginForm {
    username: Option<String>,
    password: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct ServerForm {
    name: Option<String>,
    url: Option<String>,
}

mod screens {
    use super::*;
    pub fn main(state: &State) -> Element<'_, Message> {
        empty()
    }
    pub fn server(state: &State) -> Element<'_, Message> {
        empty()
    }
    pub fn user(state: &State) -> Element<'_, Message> {
        empty()
    }
}
