<?php
namespace Lia;
interface AppInterface {
/**
* Called when all apps have been added.
*
* By default, this is called before request input or cli input is processed. (i.e. start of `$lia->deliver()` or `$lia->execute()`)
* Lia\App uses onLiaisonReady() to setup any external addons your app depends upon.
*/
public function onLiaisonReady(\Lia $lia);
/** called after input is processed */
public function onFinish(\Lia $lia);
/** Called when `$lia->terminate()` is called, which will `exit` after the `onTerminate()` event. */
public function onTerminate(\Lia $lia);
/** called by $lia->deliver() after onReady() event */
public function onStartRequest(\Lia\Http\Request $request, \Lia\Http\Response $response);
/** called by $lia->execute() after onReady() event */
public function onCliReady(\Lia\CliExecution $cli);
/** Get the liaison instance for the app */
public function getLia(): \Lia;
/** Return the app's name/namespace */
public function getNamespace(): string;
/**
* Get an addon by its name
*/
public function getAddon(string $addon_name): \Lia\AddonInterface;
/**
* Get an app's configured value. You may return null or throw if value available.
*/
public function getConfig(string $config_name): mixed;
/**
* Check if the named config is set for your app
*/
public function hasConfig(string $config_name): bool;
/**
* Get the absolute path to a directory or file within the app
*/
public function getPath(string $relative_path = ""): string;
}