<?php
require_once(__DIR__.SLASH.'ReadmeType.class.php');
class ArduinoType extends ReadmeType{

	public static function manifest(){
		return array(
			'uid' => 'arduino',
			'label' => 'Arduino',
			'icon' => 'fas fa-code',
			'color' => '#ffffff',
			'background' => '#00979d',
			'description' => 'Fichier contenant du langage arduino (proche du c++)',
			'fromExtension' => array('ino'),
			'toExtension' => 'ino',
			'default' => '
void setup()
{	
	Serial.begin(9600);
    Serial.println("Starting..");

	//pinMode(1, INPUT);
    //pinMode(2, OUTPUT);
}


void loop()
{

}',

		);
	}

	/* EDITION */
	public static function toHtml($resource,$sketch=null){
		$infos = self::manifest();
		return array(
			'html'=>'<textarea id="content" onblur="hackpoint_resource_save_content()" class="arduino-text">'.$resource->content.'</textarea>',
			'javascript' => "
				hackpoint_resource_mirrorify('.arduino-text',{
					mode : 'text/x-carduino',	
					lineNumbers : true,
					theme : 'monokai',
					readOnly : false
				});
			"
		);
	}


	
}
?>