$C = "../Common.ui";

@ContainerHeight = 730;
@MaterialSlotSize = 46;

$C.@Container {
  Anchor: (Left: 50, Top: 170, Width: 450, Bottom: 120);

  #Title {
    Group {
      LayoutMode: Left;
      $C.@Title {
        @Text = %server.customUI.entitySpawnPage.title;
      }
    }

    $C.@HeaderSearch {}
  }

  #Content {
    Group {
      LayoutMode: Left;
      Anchor: (Top: 10, Bottom: 10);

      $C.@SecondaryTextButton #TabNPC {
        Text: %server.customUI.entitySpawnPage.tab.npc;
        FlexWeight: 1;
      }

      Group {
        Anchor: (Width: 5);
      }

      $C.@SecondaryTextButton #TabItems {
        Text: %server.customUI.entitySpawnPage.tab.items;
        FlexWeight: 1;
      }

      Group {
        Anchor: (Width: 5);
      }

      $C.@SecondaryTextButton #TabModel {
        Text: %server.customUI.entitySpawnPage.tab.model;
        FlexWeight: 1;
      }
    }

    Group #NPCContent {
      Visible: true;
      FlexWeight: 1;
      LayoutMode: Top;

      Group #NPCList {
        LayoutMode: TopScrolling;
        ScrollbarStyle: $C.@DefaultScrollbarStyle;
        FlexWeight: 1;
      }
    }

    Group #ItemsContent {
      Visible: false;
      FlexWeight: 1;
      LayoutMode: Center;

      Group {
        LayoutMode: Top;
        Anchor: (Width: 120);

        Label {
          Text: %server.customUI.entitySpawnPage.material;
          Padding: (Bottom: 8);
          Style: (
            ...$C.@DefaultLabelStyle,
            HorizontalAlignment: Center
          );
        }

        Group {
          Anchor: (Height: @MaterialSlotSize);
          LayoutMode: Center;

          Group {
            Anchor: (Width: @MaterialSlotSize, Height: @MaterialSlotSize);

            ItemGrid #ItemMaterialSlot {
              Anchor: (Width: @MaterialSlotSize, Height: @MaterialSlotSize, Horizontal: 0, Vertical: 0);
              SlotsPerRow: 1;
              Style: (
                SlotSize: @MaterialSlotSize,
                SlotIconSize: @MaterialSlotSize,
                SlotSpacing: 0,
                SlotBackground: "../Common/BlockSelectorSlotBackground.png"
              );
            }

            Group #DropIndicator {
              Anchor: (Width: 24, Height: 24, Horizontal: 0, Vertical: 0);
              Background: "../Common/BlockSelectorSlotDropIcon.png";
              HitTestVisible: false;
            }
          }
        }

        $C.@SecondaryTextButton #ClearMaterial {
          Text: %server.customUI.entitySpawnPage.clear;
          Anchor: (Top: 10);
          Visible: false;
        }
      }
    }

    Group #ModelContent {
      Visible: false;
      FlexWeight: 1;
      LayoutMode: Top;

      Group #ModelList {
        LayoutMode: TopScrolling;
        ScrollbarStyle: $C.@DefaultScrollbarStyle;
        FlexWeight: 1;
      }
    }

    Group {
      LayoutMode: Top;
      Anchor: (Top: 20);
      Background: (TexturePath: "../Common/ContainerPanelPatch.png", Border: 4);
      Padding: (Bottom:18);

      Label #SelectedName {
        Padding: 8;
        Style: (
          FontSize: 18,
          RenderUppercase: true,
          RenderBold: true,
          HorizontalAlignment: Center,
          TextColor: #94969a
        );
      }

      $C.@PanelSeparatorFancy {}

      Group #RotationGroup {
        Anchor: (Top: 20);
        LayoutMode: Left;
        Padding: (Horizontal: 15);

        Label {
          Anchor: (Width: 80);
          Text: %server.customUI.generic.rotate;
          Style: (...$C.@DefaultLabelStyle, VerticalAlignment: Center, Wrap: true);
        }

        Slider #RotationOffset {
          Anchor: (Left: 25, Width: 180, Height: 5, Right: 0);
          Style: $C.@DefaultSliderStyle;
          Min: -180;
          Max: 180;
          Step: 1;
        }
      }

      Group #ScaleGroup {
        Anchor: (Top: 20);
        LayoutMode: Left;
        Padding: (Horizontal: 15);

        Label {
          Anchor: (Width: 50);
          Text: %server.customUI.entitySpawnPage.scale;
          Style: (...$C.@DefaultLabelStyle, VerticalAlignment: Center, Wrap: true);
        }

        FloatSlider #ScaleSlider {
          Anchor: (Left: 10, Width: 150, Height: 5);
          Style: $C.@DefaultSliderStyle;
          Min: 0.1;
          Max: 5.0;
          Step: 0.1;
          Value: 1.0;
        }

        Label #ScaleValue {
          Anchor: (Left: 10, Width: 40);
          Text: "1.0";
          Style: (...$C.@DefaultLabelStyle, VerticalAlignment: Center, HorizontalAlignment: End);
        }
      }

      Group {
        Anchor: (Top: 20);
        LayoutMode: Left;
        Padding: (Horizontal: 15);

        Label {
          Text: %server.customUI.generic.count;
          Style: (...$C.@DefaultLabelStyle, VerticalAlignment: Center);
          Anchor: (Width: 80);
        }
        
        $C.@NumberField #Count {
          @Anchor = (Left: 25, Width: 80,  Right: 0);
          Format: (
            MaxDecimalPlaces: 0,
            Step: 1,
            MinValue: 1,
            MaxValue: 100
          );
          Value: 1;
        }
      }
    }

    Group {
      LayoutMode: Top;
      Anchor: (Top: 15);

      $C.@TextButton #Spawn {
        Text: %server.customUI.entitySpawnPage.spawn;
      }
    }
  }
}

$C.@BackButton {}
