<?php
namespace SabaiApps\Framework\Application;

/**
 * Interface for controller classes.
 * Defines methods for setting/getting route, application, parent controller, and executing the controller.
 */
interface IController {

	/**
	 * Sets a string representation of the route to which requests should be routed.
	 *
	 * @param string $route Route identifier.
	 * @return IController Returns itself for method chaining.
	 */
	public function setRoute( $route );

	/**
	 * Sets an application instance.
	 *
	 * @param AbstractApplication $application The application instance.
	 * @return IController Returns itself for method chaining.
	 */
	public function setApplication( AbstractApplication $application );

	/**
	 * Gets the application instance.
	 *
	 * @return AbstractApplication The application instance.
	 */
	public function getApplication();

	/**
	 * Sets a parent controller.
	 *
	 * @param AbstractRoutingController $controller The parent controller.
	 * @return IController Returns itself for method chaining.
	 */
	public function setParent( AbstractRoutingController $controller );

	/**
	 * Executes the controller logic.
	 *
	 * @param Context $context The application context.
	 * @return void
	 */
	public function execute( Context $context );
}
