// The MIT License (MIT)
//
// Copyright (c) 2015, 2017 Arian Fornaris
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions: The above copyright notice and this permission
// notice shall be included in all copies or substantial portions of the
// Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
package phasereditor.canvas.core.codegen;

import phasereditor.canvas.core.CanvasModel;

/**
 * @author arian
 *
 */
public class TSGroupCodeGenerator extends JSLikeCodeGenerator {

	/**
	 * @param model
	 */
	public TSGroupCodeGenerator(CanvasModel model) {
		super(model);
	}

	@Override
	protected void generateHeader() {
		String classname = _world.getClassName();
		String baseclass = _settings.getBaseClass();
		

		line("/**");
		line(" * " + classname + ".");
		line(" * @param aGame The game.");
		line(" * @param aParent The parent group. If not given the game world will be used instead.");
		line(" */");
		line("class " + classname + " extends " + baseclass + " {");
		openIndent("constructor(aGame : Phaser.Game, aParent : Phaser.Group) {");
		line("super(aGame, aParent);");

		section(PRE_INIT_CODE_BEGIN, PRE_INIT_CODE_END, getYouCanInsertCodeHere());

		line("");
	}

	@Override
	protected void generateFooter() {
		section(POST_INIT_CODE_BEGIN, POST_INIT_CODE_END, getYouCanInsertCodeHere());
		closeIndent();
		line("}");
		closeIndent();
		section(END_GENERATED_CODE, getYouCanInsertCodeHere());
	}
}

@@ -1226,16 +1226,114 @@
 asModel;
+%0Aimport phasereditor.inspect.core.InspectCore;%0Aimport phasereditor.inspect.core.jsdoc.PhaserJSDoc;
 %0A%0A/**%0A *
@@ -1655,16 +1655,66 @@
 ss();%0A%09%09
+%0A%09%09PhaserJSDoc help = InspectCore.getPhaserHelp();
 %0A%0A%09%09line
@@ -1783,18 +1783,57 @@
 ame 
-The 
+%22 + help.getMethodArgHelp(%22Phaser.Group%22, %22
 game
-.
 %22
+)
 );%0A%09
@@ -1861,268 +1861,740 @@
 ent 
-The parent group. If not given the game world will be used instead.%22);%0A%09%09line(%22 */%22);%0A%09%09line(%22class %22 + classname + %22 extends %22 + baseclass + %22 %7B%22);%0A%09%09openIndent(%22constructor(aGame : Phaser.Game, aParent : Phaser.Group) %7B%22);%0A%09%09line(%22super(aGame, aParent
+%22 + help.getMethodArgHelp(%22Phaser.Group%22, %22parent%22));%0A%09%09line(%22 * @param aName %22 + help.getMethodArgHelp(%22Phaser.Group%22, %22name%22));%0A%09%09line(%22 * @param aAddToStage %22 + help.getMethodArgHelp(%22Phaser.Group%22, %22addToStage%22));%0A%09%09line(%22 * @param aEnableBody %22 + help.getMethodArgHelp(%22Phaser.Group%22, %22enableBody%22));%0A%09%09line(%22 * @param aPhysicsBodyType %22 + help.getMethodArgHelp(%22Phaser.Group%22, %22physicsBodyType%22));%0A%09%09line(%22 */%22);%0A%09%09line(%22class %22 + classname + %22 extends %22 + baseclass + %22 %7B%22);%0A%09%09openIndent(%22constructor(aGame : Phaser.Game, aParent : Phaser.Group, aName : string, aAddToStage : boolean, aEnableBody : boolean, aPhysicsBodyType : number) %7B%22);%0A%09%09line(%22super(aGame, aParent, aName, aAddToStage, aEnableBody, aPhysicsBodyType
 );%22);%0A
-%0A
 %09%09se

fix TS group code generator.