<?php
    define( 'APP_SPACE',                          'TheTempusProject' );
if ( ! defined( 'APP_ROOT_DIRECTORY' ) ) {
    define( 'APP_ROOT_DIRECTORY',                 dirname( __DIR__ ) . DIRECTORY_SEPARATOR ); // need to verify
}
    define( 'APP_DIRECTORY',                      APP_ROOT_DIRECTORY  . 'app'               . DIRECTORY_SEPARATOR );
// Directories
    define( 'CSS_DIRECTORY',                      APP_ROOT_DIRECTORY  . 'css'               . DIRECTORY_SEPARATOR );
    define( 'IMAGE_DIRECTORY',                    APP_ROOT_DIRECTORY  . 'images'            . DIRECTORY_SEPARATOR );
    define( 'JAVASCRIPT_DIRECTORY',               APP_ROOT_DIRECTORY  . 'js'                . DIRECTORY_SEPARATOR );
    define( 'HTACCESS_LOCATION',                  APP_ROOT_DIRECTORY  . '.htaccess' );
if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
    define( 'CONFIG_DIRECTORY',                   APP_DIRECTORY       . 'config'            . DIRECTORY_SEPARATOR );
}
    define( 'PLUGIN_DIRECTORY',                   APP_DIRECTORY       . 'plugins'           . DIRECTORY_SEPARATOR );
    define( 'MODEL_DIRECTORY',                    APP_DIRECTORY       . 'models'            . DIRECTORY_SEPARATOR );
    define( 'CONTROLLER_DIRECTORY',               APP_DIRECTORY       . 'controllers'       . DIRECTORY_SEPARATOR );
    define( 'ADMIN_CONTROLLER_DIRECTORY',         CONTROLLER_DIRECTORY. 'admin'             . DIRECTORY_SEPARATOR );
    define( 'API_CONTROLLER_DIRECTORY',           CONTROLLER_DIRECTORY. 'api'               . DIRECTORY_SEPARATOR );
// Files
    define( 'PERMISSIONS_JSON',                   CONFIG_DIRECTORY    . 'permissions.json' );
    define( 'PREFERENCES_JSON',                   CONFIG_DIRECTORY    . 'preferences.json' );
    define( 'INSTALL_JSON_LOCATION',              CONFIG_DIRECTORY    . 'install.json' );
    define( 'INSTALLER_LOCATION',                 APP_ROOT_DIRECTORY  . 'install.php' );
// Other
    define( 'PLUGINS_ENABLED',                    true );
    define( 'INSTALL_STATUS_NOT_REQUIRED',        'Not Required' );
    define( 'INSTALL_STATUS_NOT_FOUND',           'Not Found' );
    define( 'INSTALL_STATUS_PARTIALLY_INSTALLED', 'Partially Installed' );
    define( 'INSTALL_STATUS_NOT_INSTALLED',       'Not Installed' );
    define( 'INSTALL_STATUS_INSTALLED',           'Installed' );
    define( 'INSTALL_STATUS_UNINSTALLED',         'Uninstalled' );
    define( 'INSTALL_STATUS_SUCCESS',             'Success' );
    define( 'INSTALL_STATUS_SKIPPED',             'Skipped' );
    define( 'INSTALL_STATUS_FAIL',                'Failed' );
    define( 'MODEL_INSTALL_FLAGS',                [ 'installTable', 'installPermissions', 'installConfigs', 'installResources', 'installPreferences' ] );
    define( 'PLUGIN_INSTALL_FLAGS',               [ 'models_installed', 'permissions_installed', 'configs_installed', 'resources_installed', 'preferences_installed' ] );
# Tempus Debugger
    define( 'CANARY_SECURE_HASH',        'd73ed7591a30f0ca7d686a0e780f0d05' );
# Tempus Project Core
define( 'APP_NAME',            'Joey Kimsey');
define( 'TP_DEFAULT_LOGO',            'images/logo.png');
    // Check
        define( 'MINIMUM_PHP_VERSION',            8.1);
    // Cookies
        define( 'DEFAULT_COOKIE_PREFIX',          'TP_');
    // Debug
	
    	define( 'CANARY_DEBUG_DIRECTORY', APP_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR  );
        define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
        define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
        define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
        define( 'CANARY_DEBUG_LEVEL_LOG', 'log' );
        define( 'CANARY_DEBUG_LEVEL_DEBUG', 'debug' );
        define( 'CANARY_DEBUG_TO_FILE_LEVEL', CANARY_DEBUG_LEVEL_INFO );
        define( 'CANARY_ENABLED', true );
        define( 'DEBUG_EMAIL', 'webmaster@' . $_SERVER['HTTP_HOST'] );
        define( 'HERMES_REDIRECTS_ENABLED', true );
        define( 'RENDERING_ENABLED', true );
        define( 'CANARY_TRACE_ENABLED', false );
        define( 'CANARY_DEBUG_TO_CONSOLE', false );
        define( 'CANARY_DEBUG_TO_FILE', true );
    // Directories
        if ( ! defined( 'VENDOR_DIRECTORY' ) ) {
            define( 'VENDOR_DIRECTORY',               APP_ROOT_DIRECTORY  . 'vendor'            . DIRECTORY_SEPARATOR );
        }
        if ( is_dir( VENDOR_DIRECTORY . 'thetempusproject' )) {
            define( 'TP_VENDOR_DIRECTORY',        VENDOR_DIRECTORY    . 'thetempusproject'  . DIRECTORY_SEPARATOR );
        } elseif ( is_dir( VENDOR_DIRECTORY . 'TheTempusProject' )) {
            define( 'TP_VENDOR_DIRECTORY',        VENDOR_DIRECTORY    . 'TheTempusProject'  . DIRECTORY_SEPARATOR );
        } else {
            define( 'TP_VENDOR_DIRECTORY',        VENDOR_DIRECTORY);
        }
        # Bedrock
            if ( is_dir( TP_VENDOR_DIRECTORY       . 'tempusprojectcore' )) {
                define( 'BEDROCK_ROOT_DIRECTORY',     TP_VENDOR_DIRECTORY . 'tempusprojectcore' . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusProjectCore' )) {
                define( 'BEDROCK_ROOT_DIRECTORY',     TP_VENDOR_DIRECTORY . 'TempusProjectCore' . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'bedrock' )) {
                define( 'BEDROCK_ROOT_DIRECTORY',     TP_VENDOR_DIRECTORY . 'bedrock'           . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Bedrock' )) {
                define( 'BEDROCK_ROOT_DIRECTORY',     TP_VENDOR_DIRECTORY . 'Bedrock'           . DIRECTORY_SEPARATOR );
            }
            if ( is_dir( BEDROCK_ROOT_DIRECTORY       . 'config' )) {
                define( 'BEDROCK_CONFIG_DIRECTORY',      BEDROCK_ROOT_DIRECTORY . 'config'    . DIRECTORY_SEPARATOR );
            }
        # Canary
            if ( is_dir( TP_VENDOR_DIRECTORY       . 'tempusdebugger' )) {
                define( 'CANARY_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'tempusdebugger'    . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusDebugger' )) {
                define( 'CANARY_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'TempusDebugger'    . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'canary' )) {
                define( 'CANARY_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'canary'            . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Canary' )) {
                define( 'CANARY_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'Canary'            . DIRECTORY_SEPARATOR );
            }
            if ( is_dir( CANARY_ROOT_DIRECTORY       . 'config' )) {
                define( 'CANARY_CONFIG_DIRECTORY',      CANARY_ROOT_DIRECTORY . 'config'    . DIRECTORY_SEPARATOR );
            }
        # Hermes
            if ( is_dir( TP_VENDOR_DIRECTORY       . 'hermes' )) {
                define( 'HERMES_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'hermes'    . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Hermes' )) {
                define( 'HERMES_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'Hermes'    . DIRECTORY_SEPARATOR );
            }
            if ( is_dir( HERMES_ROOT_DIRECTORY       . 'config' )) {
                define( 'HERMES_CONFIG_DIRECTORY',      HERMES_ROOT_DIRECTORY . 'config'    . DIRECTORY_SEPARATOR );
            }
        # Houdini
            if ( is_dir( TP_VENDOR_DIRECTORY       . 'houdini' )) {
                define( 'HOUDINI_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'houdini'    . DIRECTORY_SEPARATOR );
            } elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Houdini' )) {
                define( 'HOUDINI_ROOT_DIRECTORY',      TP_VENDOR_DIRECTORY . 'Houdini'    . DIRECTORY_SEPARATOR );
            }
            if ( is_dir( HOUDINI_ROOT_DIRECTORY       . 'config' )) {
                define( 'HOUDINI_CONFIG_DIRECTORY',      HOUDINI_ROOT_DIRECTORY . 'config'    . DIRECTORY_SEPARATOR );
            }
    // Shared Directories
        define( 'BIN_DIRECTORY',                  APP_ROOT_DIRECTORY  . 'bin'               . DIRECTORY_SEPARATOR );
        define( 'VIEW_DIRECTORY',                 APP_DIRECTORY       . 'views'             . DIRECTORY_SEPARATOR );
            define( 'ERRORS_DIRECTORY',           VIEW_DIRECTORY      . 'errors'            . DIRECTORY_SEPARATOR );
        define( 'CLASSES_DIRECTORY',              APP_DIRECTORY       . 'classes'           . DIRECTORY_SEPARATOR );
        define( 'FUNCTIONS_DIRECTORY',            APP_DIRECTORY       . 'functions'         . DIRECTORY_SEPARATOR );
        define( 'RESOURCES_DIRECTORY',            APP_DIRECTORY       . 'resources'         . DIRECTORY_SEPARATOR );
        define( 'TEMPLATE_DIRECTORY',             APP_DIRECTORY       . 'templates'         . DIRECTORY_SEPARATOR );
        define( 'UPLOAD_DIRECTORY',               APP_ROOT_DIRECTORY  . 'uploads'           . DIRECTORY_SEPARATOR );
            define( 'IMAGE_UPLOAD_DIRECTORY',     UPLOAD_DIRECTORY    . 'images'            . DIRECTORY_SEPARATOR );
    // Files
        define( 'COMPOSER_JSON_LOCATION',         APP_ROOT_DIRECTORY  . 'composer.json' );
        define( 'COMPOSER_LOCK_LOCATION',         APP_ROOT_DIRECTORY  . 'composer.lock' );
        define( 'CONFIG_JSON',                    CONFIG_DIRECTORY    . 'config.json' );
    // Other
        define( 'EMAIL_FROM_EMAIL',               'noreply@localohost.com' );
    // Sessions
        define( 'DEFAULT_SESSION_PREFIX',         'TP_' );
    // Token
        define( 'DEFAULT_TOKEN_NAME',             'TP_SESSION_TOKEN' );
# Tell the app; all constants have been loaded
    define( 'TEMPUS_PROJECT_CONSTANTS_LOADED',    true );
