{
  "Type": "Window",
  "Id": "ordnance_designer",
  "Title": "Missile Design",
  "Icon": "\ud83d\ude80",
  "Classes": [
    "ps-window-holo"
  ],
  "State": "Maximized",
  "DisplayLocation": "Taskbar",
  "WindowGroup": "static_menu",
  "IsRestorable": false,
  "IsMinimizable": false,
  "Width": "100%",
  "Height": "100%",
  "Background": "rgba(0,0,0,0.85)",
  "BackgroundImage": "UI/Backgrounds/ordnance_designer.jpg",
  "Padding": "16",
  "Children": [
    {
      "Type": "Grid",
      "Id": "ordnance_designer_layout",
      "Width": "100%",
      "Height": "100%",
      "HorizontalAlignment": "Stretch",
      "VerticalAlignment": "Stretch",
      "ColumnDefinitions": [
        "1fr",
        "2fr",
        "1.5fr"
      ],
      "RowDefinitions": [
        "auto",
        "1fr",
        "auto"
      ],
      "Children": [
        {
          "Type": "Select",
          "Id": "ordnance_race_select",
          "Grid.Column": 0,
          "Grid.Row": 0,
          "Width": "100%",
          "Margin": "0 0 12px 0",
          "Value": "",
          "Options": [],
          "Placeholder": "Select race",
          "Command": "core.ordnance.select_race"
        },
        {
          "Type": "StackPanel",
          "Grid.Column": 1,
          "Grid.Row": 0,
          "Orientation": "Horizontal",
          "Gap": 8,
          "Margin": "0 0 12px 0",
          "HorizontalAlignment": "Stretch",
          "VerticalAlignment": "Center",
          "Children": [
            {
              "Type": "Label",
              "Id": "ordnance_load_previous_label",
              "Text": "Load Previous",
              "VerticalAlignment": "Center"
            },
            {
              "Type": "Select",
              "Id": "ordnance_previous_design_select",
              "Flex": "1",
              "Value": "",
              "Options": [],
              "Placeholder": "Select a design to load",
              "Command": "core.ordnance.load_previous"
            }
          ]
        },
        {
          "Type": "Checkbox",
          "Id": "ordnance_freeze_name",
          "Grid.Column": 2,
          "Grid.Row": 0,
          "HorizontalAlignment": "Right",
          "VerticalAlignment": "Center",
          "Margin": "0 0 12px 0",
          "Label": "Freeze Name",
          "Command": "core.ordnance.toggle_freeze_name"
        },
        {
          "Type": "ScrollBox",
          "Id": "ordnance_left_panel",
          "Grid.Column": 0,
          "Grid.Row": 1,
          "Axis": "Vertical",
          "Width": "100%",
          "Height": "100%",
          "Padding": "8",
          "Background": "transparent",
          "Children": [
            {
              "Type": "DataGrid",
              "Id": "ordnance_msp_grid",
              "Width": "100%",
              "Height": "100%",
              "HeadersVisible": true,
              "Compact": true,
              "EnableVerticalScroll": false,
              "AllowSorting": false,
              "AllowReorder": false,
              "SelectionMode": "None",
              "OnCellEdited": "core.ordnance.grid_edit",
              "Columns": [
                {
                  "Header": "Parameter",
                  "Field": "label",
                  "Width": "2fr"
                },
                {
                  "Header": "MSP",
                  "Field": "msp",
                  "Width": "1fr",
                  "Align": "Right",
                  "Editable": true,
                  "EditorType": "Number",
                  "EditCommand": "core.ordnance.grid_edit"
                },
                {
                  "Header": "Value",
                  "Field": "value",
                  "Width": "1fr",
                  "Align": "Right"
                }
              ],
              "Rows": []
            }
          ]
        },
        {
          "Type": "ScrollBox",
          "Id": "ordnance_middle_panel",
          "Grid.Column": 1,
          "Grid.Row": 1,
          "Axis": "Vertical",
          "Width": "100%",
          "Height": "100%",
          "Padding": "8",
          "Background": "transparent",
          "Children": [
            {
              "Type": "StackPanel",
              "Id": "ordnance_middle_content",
              "Orientation": "Vertical",
              "Gap": 12,
              "Width": "100%",
              "Children": [
                {
                  "Type": "Panel",
                  "Id": "ordnance_engine_panel",
                  "Width": "100%",
                  "Classes": [
                    "ps-panel",
                    "ps-panel--glass"
                  ],
                  "Children": [
                    {
                      "Type": "StackPanel",
                      "Id": "ordnance_engine_content",
                      "Orientation": "Vertical",
                      "Gap": 8,
                      "Width": "100%",
                      "Children": [
                        {
                          "Type": "Label",
                          "Id": "ordnance_engine_heading",
                          "Text": "Engine Technology"
                        },
                        {
                          "Type": "Select",
                          "Id": "ordnance_engine_power_select",
                          "Width": "100%",
                          "Classes": [
                            "ps-select-shell--full"
                          ],
                          "Value": "",
                          "Options": [],
                          "Placeholder": "Select engine power",
                          "Command": "core.ordnance.select_engine_power"
                        },
                        {
                          "Type": "Select",
                          "Id": "ordnance_engine_size_select",
                          "Width": "100%",
                          "Classes": [
                            "ps-select-shell--full"
                          ],
                          "Value": "",
                          "Options": [],
                          "Placeholder": "Select engine size",
                          "Command": "core.ordnance.select_engine_size"
                        },
                        {
                          "Type": "PropertyGrid",
                          "Id": "ordnance_engine_stats",
                          "Classes": [
                            "ps-pgrid--compact"
                          ],
                          "Sections": []
                        }
                      ]
                    }
                  ]
                },
                {
                  "Type": "Panel",
                  "Id": "ordnance_second_stage_panel",
                  "Width": "100%",
                  "Classes": [
                    "ps-panel",
                    "ps-panel--glass"
                  ],
                  "Children": [
                    {
                      "Type": "StackPanel",
                      "Id": "ordnance_second_stage_content",
                      "Orientation": "Vertical",
                      "Gap": 8,
                      "Width": "100%",
                      "Children": [
                        {
                          "Type": "Label",
                          "Id": "ordnance_second_stage_heading",
                          "Text": "Second Stage"
                        },
                        {
                          "Type": "Select",
                          "Id": "ordnance_second_stage_select",
                          "Width": "100%",
                          "Classes": [
                            "ps-select-shell--full"
                          ],
                          "Value": "",
                          "Options": [],
                          "Placeholder": "Select second-stage design",
                          "Command": "core.ordnance.select_second_stage_design"
                        },
                        {
                          "Type": "StackPanel",
                          "Orientation": "Horizontal",
                          "Gap": 8,
                          "Width": "100%",
                          "Children": [
                            {
                              "Type": "StackPanel",
                              "Orientation": "Vertical",
                              "Gap": 2,
                              "Flex": "1",
                              "Children": [
                                {
                                  "Type": "Label",
                                  "Text": "Number",
                                  "Classes": [
                                    "ps-label--subtle"
                                  ]
                                },
                                {
                                  "Type": "Input",
                                  "Id": "ordnance_second_stage_count",
                                  "Width": "100%",
                                  "Placeholder": "0",
                                  "InputType": "Number",
                                  "Command": "core.ordnance.set_second_stage_count"
                                }
                              ]
                            },
                            {
                              "Type": "StackPanel",
                              "Orientation": "Vertical",
                              "Gap": 2,
                              "Flex": "1",
                              "Children": [
                                {
                                  "Type": "Label",
                                  "Text": "Separation Range (k)",
                                  "Classes": [
                                    "ps-label--subtle"
                                  ]
                                },
                                {
                                  "Type": "Input",
                                  "Id": "ordnance_second_stage_range",
                                  "Width": "100%",
                                  "Placeholder": "150",
                                  "InputType": "Number",
                                  "Command": "core.ordnance.set_second_stage_range"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "Type": "PropertyGrid",
                          "Id": "ordnance_second_stage_stats",
                          "Classes": [
                            "ps-pgrid--compact"
                          ],
                          "Sections": []
                        }
                      ]
                    }
                  ]
                },
                {
                  "Type": "StackPanel",
                  "Id": "ordnance_name_row",
                  "Orientation": "Horizontal",
                  "Gap": 8,
                  "Width": "100%",
                  "Children": [
                    {
                      "Type": "Input",
                      "Id": "ordnance_company_name_input",
                      "Width": "45%",
                      "Placeholder": "Company Name",
                      "Command": "core.ordnance.set_company_name"
                    },
                    {
                      "Type": "Input",
                      "Id": "ordnance_design_name_input",
                      "Width": "55%",
                      "Placeholder": "Design Name",
                      "Command": "core.ordnance.set_design_name"
                    }
                  ]
                },
                {
                  "Type": "Panel",
                  "Id": "ordnance_specs_glass",
                  "Width": "100%",
                  "Classes": [
                    "ps-panel",
                    "ps-panel--glass"
                  ],
                  "Children": [
                    {
                      "Type": "StackPanel",
                      "Id": "ordnance_specs_content",
                      "Orientation": "Vertical",
                      "Gap": 6,
                      "Width": "100%",
                      "Children": [
                        {
                          "Type": "Label",
                          "Id": "ordnance_specs_heading",
                          "Text": "Design Summary"
                        },
                        {
                          "Type": "Label",
                          "Id": "ordnance_specs_text",
                          "Text": "Live calculations will appear here in the next task.",
                          "Width": "100%",
                          "Classes": [
                            "designer-specs"
                          ]
                        },
                        {
                          "Type": "Label",
                          "Id": "ordnance_status_text",
                          "Text": "Shell ready. Calculator wiring arrives next.",
                          "Width": "100%",
                          "Classes": [
                            "ps-text-secondary"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "Type": "Panel",
          "Id": "ordnance_right_panel",
          "Grid.Column": 2,
          "Grid.Row": 1,
          "Width": "100%",
          "Height": "100%",
          "Padding": "8",
          "Background": "transparent",
          "Children": [
            {
              "Type": "Grid",
              "Id": "ordnance_right_content",
              "Width": "100%",
              "Height": "100%",
              "ColumnDefinitions": [
                "1fr"
              ],
              "RowDefinitions": [
                "auto",
                "1fr",
                "auto",
                "1fr"
              ],
              "Children": [
                {
                  "Type": "Label",
                  "Id": "ordnance_designs_heading",
                  "Text": "Existing Designs",
                  "Grid.Column": 0,
                  "Grid.Row": 0
                },
                {
                  "Type": "DataGrid",
                  "Id": "ordnance_existing_designs_grid",
                  "Grid.Column": 0,
                  "Grid.Row": 1,
                  "Width": "100%",
                  "Height": "100%",
                  "UseZebraStriping": true,
                  "SelectionMode": "Single",
                  "OnSelectionChanged": "core.ordnance.select_design",
                  "Columns": [
                    {
                      "Header": "Name",
                      "Field": "name",
                      "Width": "1.6fr"
                    },
                    {
                      "Header": "Type",
                      "Field": "type",
                      "Width": "1fr"
                    },
                    {
                      "Header": "MSP",
                      "Field": "msp",
                      "Width": "0.7fr",
                      "Align": "Right"
                    }
                  ],
                  "Rows": []
                },
                {
                  "Type": "Label",
                  "Id": "ordnance_attributes_heading",
                  "Text": "Available Tech",
                  "Grid.Column": 0,
                  "Grid.Row": 2,
                  "Margin": "8 0 0 0"
                },
                {
                  "Type": "ScrollBox",
                  "Id": "ordnance_attributes_scroll",
                  "Grid.Column": 0,
                  "Grid.Row": 3,
                  "Axis": "Vertical",
                  "Width": "100%",
                  "Height": "100%",
                  "Background": "transparent",
                  "Children": [
                    {
                      "Type": "PropertyGrid",
                      "Id": "ordnance_attribute_grid",
                      "Classes": [
                        "ps-pgrid--compact"
                      ],
                      "Sections": []
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "Type": "StackPanel",
          "Grid.Column": 0,
          "Grid.ColumnSpan": 3,
          "Grid.Row": 2,
          "Id": "ordnance_action_bar",
          "Orientation": "Horizontal",
          "HorizontalAlignment": "Left",
          "VerticalAlignment": "Center",
          "Gap": 8,
          "Margin": "10 0 0 0",
          "Children": [
            {
              "Type": "Button",
              "Id": "ordnance_create_button",
              "Text": "Create",
              "Style": "Primary",
              "Command": "core.ordnance.create",
              "Width": "120px"
            },
            {
              "Type": "Button",
              "Id": "ordnance_instant_button",
              "Text": "Instant",
              "Style": "SpaceMaster",
              "Command": "core.ordnance.instant",
              "Width": "120px"
            },
            {
              "Type": "Button",
              "Id": "ordnance_company_button",
              "Text": "Company Name",
              "Command": "core.ordnance.company_name",
              "Width": "140px"
            }
          ]
        }
      ]
    },
    {
      "Type": "Modal",
      "Id": "ordnance_load_confirm_modal",
      "Title": "Load Design?",
      "IsVisible": false,
      "CloseOnEscape": true,
      "CloseCommand": "core.ordnance.cancel_load",
      "Size": "Small",
      "BadgeText": "Warning",
      "BadgeVariant": "warn",
      "AccentVariant": "Warning",
      "DisplayMode": "Glow",
      "Children": [
        {
          "Type": "Label",
          "Id": "ordnance_load_confirm_body",
          "Text": "Loading a different design will reset all unsaved changes. Continue?"
        }
      ],
      "FooterChildren": [
        {
          "Type": "StackPanel",
          "Orientation": "Horizontal",
          "HorizontalAlignment": "Right",
          "Gap": 8,
          "Children": [
            {
              "Type": "Button",
              "Text": "Cancel",
              "Command": "core.ordnance.cancel_load"
            },
            {
              "Type": "Button",
              "Text": "Load Design",
              "Style": "Primary",
              "Command": "core.ordnance.confirm_load"
            }
          ]
        }
      ]
    }
  ]
}
