use core::num::NonZeroU32;

use bone_ui::layout::{DockState, PanelId};

fn pid(n: u32) -> PanelId {
    PanelId::new(NonZeroU32::new(n).unwrap_or(NonZeroU32::MIN))
}

fn solidworks_default() -> DockState {
    let Ok(state) = DockState::solidworks_default(pid(1), pid(2), pid(3), pid(4), pid(5), pid(6))
    else {
        panic!("solidworks_default rejected distinct ids");
    };
    state
}

#[test]
fn solidworks_default_dock_layout_snapshot() {
    insta::assert_ron_snapshot!("dock_solidworks_default", solidworks_default());
}

#[test]
fn solidworks_default_dock_round_trip_is_stable() {
    let original = solidworks_default();
    let Ok(first) = ron::ser::to_string(&original) else {
        panic!("first serialize failed");
    };
    let Ok(parsed) = ron::de::from_str::<DockState>(&first) else {
        panic!("deserialize failed");
    };
    let Ok(second) = ron::ser::to_string(&parsed) else {
        panic!("second serialize failed");
    };
    assert_eq!(first, second);
    assert_eq!(original, parsed);
}
