<?php

/*
 | --------------------------------------------------------------------
 | App Namespace
 | --------------------------------------------------------------------
 |
 | This defines the default Namespace that is used throughout
 | CodeIgniter to refer to the Application directory. Change
 | this constant to change the namespace that all application
 | classes should use.
 |
 | NOTE: changing this will require manually modifying the
 | existing namespaces of App\* namespaced-classes.
 */
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');

/*
 | --------------------------------------------------------------------------
 | Composer Path
 | --------------------------------------------------------------------------
 |
 | The path that Composer's autoload file is expected to live. By default,
 | the vendor folder is in the Root directory, but you can customize that here.
 */
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');

/*
 |--------------------------------------------------------------------------
 | Timing Constants
 |--------------------------------------------------------------------------
 |
 | Provide simple ways to work with the myriad of PHP functions that
 | require information to be in seconds.
 */
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR')   || define('HOUR', 3600);
defined('DAY')    || define('DAY', 86400);
defined('WEEK')   || define('WEEK', 604800);
defined('MONTH')  || define('MONTH', 2_592_000);
defined('YEAR')   || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);

/*
 | --------------------------------------------------------------------------
 | Exit Status Codes
 | --------------------------------------------------------------------------
 |
 | Used to indicate the conditions under which the script is exit()ing.
 | While there is no universal standard for error codes, there are some
 | broad conventions.  Three such conventions are mentioned below, for
 | those who wish to make use of them.  The CodeIgniter defaults were
 | chosen for the least overlap with these conventions, while still
 | leaving room for others to be defined in future versions and user
 | applications.
 |
 | The three main conventions used for determining exit status codes
 | are as follows:
 |
 |    Standard C/C++ Library (stdlibc):
 |       http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
 |       (This link also contains other GNU-specific conventions)
 |    BSD sysexits.h:
 |       http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
 |    Bash scripting:
 |       http://tldp.org/LDP/abs/html/exitcodes.html
 |
 */
defined('EXIT_SUCCESS')        || define('EXIT_SUCCESS', 0);        // no errors
defined('EXIT_ERROR')          || define('EXIT_ERROR', 1);          // generic error
defined('EXIT_CONFIG')         || define('EXIT_CONFIG', 3);         // configuration error
defined('EXIT_UNKNOWN_FILE')   || define('EXIT_UNKNOWN_FILE', 4);   // file not found
defined('EXIT_UNKNOWN_CLASS')  || define('EXIT_UNKNOWN_CLASS', 5);  // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT')     || define('EXIT_USER_INPUT', 7);     // invalid user input
defined('EXIT_DATABASE')       || define('EXIT_DATABASE', 8);       // database error
defined('EXIT__AUTO_MIN')      || define('EXIT__AUTO_MIN', 9);      // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX')      || define('EXIT__AUTO_MAX', 125);    // highest automatically-assigned error code

/**
 * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
 */
define('EVENT_PRIORITY_LOW', 200);

/**
 * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
 */
define('EVENT_PRIORITY_NORMAL', 100);

/**
 * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
 */
define('EVENT_PRIORITY_HIGH', 10);

define('LAYOUTS', [
  'empty' => [
    'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty',
    'stylesheets' => [
      '<link rel="icon" href="/favicon.ico">',
      '<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
    ],
    'javascripts' => [
      '<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
    ]
  ],
  'front' => [
    'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front',
    'stylesheets' => [
      '<link rel="icon" href="/favicon.ico">',
      '<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
      '<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
      '<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css" />',
    ],
    'javascripts' => [
      '<script src="//cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>',
      '<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
      '<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
    ]
  ],
  'admin' => [
    'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin',
    'stylesheets' => [
      '<link rel="icon" href="/favicon.ico">',
      '<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
      '<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
      '<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css" />',
    ],
    'javascripts' => [
      '<script src="//cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>',
      '<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
      '<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
    ]
  ]
]);

//Login 관련
defined('ISLOGIN')        || define('ISLOGIN', "isLoggedIn");
defined('RETURN_URL')     || define('RETURN_URL', "return_url");

//Default 정의
defined('DEFAULT_ROLE')   || define('DEFAULT_ROLE', 'user');
defined('DEFAULT_STATUS') || define('DEFAULT_STATUS', 'use');
defined('DEFAULT_EMPTY') || define('DEFAULT_EMPTY', '');
defined('DEFAULT_PERPAGE') || define('DEFAULT_PERPAGE', 20);
defined('Excel_FilePath')   || define('Excel_FilePath', "../writable/Excel");
if (!is_dir(Excel_FilePath)) {
  mkdir(Excel_FilePath, 0640);
}
//Cloudflare CLI MAX_PER_PAGE정의
defined('CF_REQUEST_MAX')   || define('CF_REQUEST_MAX', 1000);
defined('CF_REQUEST_WAITTIME')   || define('CF_REQUEST_WAITTIME', 60); //Default 60
defined('CF_ADAPTER_PERPAGE_MAX')   || define('CF_ADAPTER_PERPAGE_MAX', 700); //Default 700
defined('CF_DEFAULT_RELOADING_OPTIONS')   || define('CF_DEFAULT_RELOADING_OPTIONS', ['page_limit' => 0, 'child' => 'off', 'cfsetting' => 'off']);
defined('CF_DEFAULT_HOSTS')   || define('CF_DEFAULT_HOSTS', ['@', '*', 'm', 'www']);
defined('CF_FilePath')   || define('CF_FilePath', "../writable/Cloudflare");
if (!is_dir(CF_FilePath)) {
  mkdir(CF_FilePath);
}

//Upload , Download 관려
define('FILES', [
  'UPLOADS' => ['mode' => 0600, 'path' => 'uploads'],
  'DOWNLOADS' => ['mode' => 0600, 'path' => 'downloads'],
]);

//아이콘 및 Sound관련
//'EXCEL' => '<i class="fa fa-file-excel-o" aria-hidden="true"></i>',
define('ICONS', [
  'NEW'     => '<i class="fa fa-paper-plane" aria-hidden="true"></i>',
  'DELETE'  => '<i class="fa fa-trash-o"></i>',
  'RELOAD'  => '<i class="fa fa-refresh" aria-hidden="true"></i>',
  'SETTING' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
  'FLAG'    => '<i class="fa fa-flag" aria-hidden="true"></i>',
  'EXCEL'   => '<i class="fa fa-file-excel-o" style="font-size:24px"></i>',
  'AUDIO_Alram_GetEmail' => '<object width=0 height=0 data="/sound/jarvis_email.mp3" type="audio/mpeg"></object>'
]);
