use crate::monitor::Monitor;
use crate::coords::proj::Mercator;
use crate::render::{
    BackgroundConfig, BackgroundWidget, ForegroundConfig, ForegroundWidget, Render,
};
use gtk::prelude::{BoxExt, ButtonExt, GtkWindowExt, OrientableExt, ToggleButtonExt};
use relm4::*;

pub struct RenderPanelModel;

#[relm4::component(pub)]
impl SimpleComponent for RenderPanelModel {
    type Init = i8;
    type Output = ();
    type Input = ();

    view! {
        #[root]
            Monitor::new(
                Render::new(
                    BackgroundWidget::new(BackgroundConfig{ show_lat_lines: true, show_lon_lines: true, ..Default::default() }),
                    ForegroundWidget::new(ForegroundConfig::default()),
                    Some(Mercator::new().into())
                )
            ),
    }

    fn init(
        init: Self::Init,
        root: &Self::Root,
        sender: relm4::ComponentSender<Self>,
    ) -> relm4::ComponentParts<Self> {
        let model = RenderPanelModel {};
        // Insert the macro code generation here
        let widgets = view_output!();

        ComponentParts { model, widgets }
    }
    fn update(&mut self, msg: Self::Input, _sender: ComponentSender<Self>) {}
}
