<?php
/**
 *
 * @copyright Copyright (c) Miroslav Marek <mirek.marek@web-jet.cz>
 * @license http://www.php-jet.net/license/license.txt
 * @author Miroslav Marek <mirek.marek@web-jet.cz>
 */

namespace JetStudioModule\DataModel;

use Jet\DataModel_Definition_Property_IdAutoIncrement as Jet_DataModel_Definition_Property_IdAutoIncrement;
use Jet\Form_Field;
use JetStudio\ClassCreator_Class;
use JetStudio\ClassCreator_Class_Property;

/**
 *
 */
class DataModel_Definition_Property_IdAutoIncrement extends Jet_DataModel_Definition_Property_IdAutoIncrement implements DataModel_Definition_Property_Interface
{
	use DataModel_Definition_Property_Trait;


	/**
	 * @param Form_Field[] &$fields
	 */
	public function getEditFormCustomFields( array &$fields ): void
	{
	}

	/**
	 *
	 */
	public function showEditFormFields(): void
	{
	}


	/**
	 * @return int
	 */
	public function getDefaultValue() : int
	{
		return 0;
	}


	/**
	 *
	 * @param ClassCreator_Class $class
	 *
	 * @return ClassCreator_Class_Property
	 */
	public function createClassProperty( ClassCreator_Class $class ): ClassCreator_Class_Property
	{
		return $this->createClassProperty_main( $class, 'int', 'DataModel::TYPE_ID_AUTOINCREMENT' );
	}

	/**
	 * @param ClassCreator_Class $class
	 *
	 * @return array
	 */
	public function createClassMethods( ClassCreator_Class $class ): array
	{
		$s_g_method_name = $this->getSetterGetterMethodName();

		$getter = $class->createMethod( 'get' . $s_g_method_name );
		$getter->setReturnType( 'int' );
		$getter->line( 1, 'return $this->' . $this->getName() . ';' );

		return ['get' . $s_g_method_name];
	}

}