import { Component, Behavior, BehaviorConstructorProps, ContextManager, registerBehaviorRunAtDesignTime } from "@zcomponent/core";
import { Object3D } from "@zcomponent/three";

// For type-safe access into your zcomp file, import it at the top like this,
// then pass the class into `getZComponentInstance` below
// import { default as Scene } from './Scene.zcomp';

interface ConstructionProps {
	// Add any constructor props you'd like for your behavior here
}

// The type of node that this behavior can be attached to
type NodeType = Object3D;

/**
 * @zbehavior 
 * @zparents three/Object3D
 **/
export class CustomBehavior extends Behavior<NodeType> {

	// The zcomponent this behavior has been constructed in
	// For type-safe access to the zcomp, import it above and pass the class in here
	protected zcomponent = this.getZComponentInstance(/* Scene */);
		

	constructor(contextManager: ContextManager, instance: NodeType, protected constructorProps: ConstructionProps) {
		super(contextManager, instance);

		/*
		// You can register handlers for events on the node that this behavior
		// is attached to like this:

		this.register(this.instance.onPointerDown, evt => {
			// Code to handle event
		});

		// Or against other nodes in your zcomp file
		this.register(this.zcomponent.nodes.MyNode.onPointerDown, evt => {

		});
		
		*/
	}

	dispose() {
		// Clean up any resources
		// ...
		return super.dispose();
	}
}

// Uncomment below to run this behavior at design time
// registerBehaviorRunAtDesignTime(MyBehavior);
