<?php
defined('PATH_CLIENT') ? null : define('PATH_CLIENT', 'client/');

defined('PATH_IMG') ? null : define('PATH_IMG', PATH_CLIENT.'img/');
defined('PATH_CSS') ? null : define('PATH_CSS', PATH_CLIENT.'css/');
defined('PATH_JS') ? null : define('PATH_JS', PATH_CLIENT.'js/');
defined('PATH_JS_LIBS') ? null : define('PATH_JS_LIBS', PATH_JS.'bower_components/');
defined('PATH_JS_COMPONENTS') ? null : define('PATH_JS_COMPONENTS', PATH_JS.'components/');

defined('PATH_SERVER') ? null : define('PATH_SERVER', 'server/');

defined('PATH_COMPONENTS') ? null : define('PATH_COMPONENTS', PATH_SERVER.'components/');
defined('PATH_CORE') ? null : define('PATH_CORE', PATH_SERVER.'core/');
defined('ROOT_DIR') ? null : define('ROOT_DIR', __DIR__.'/');
defined('PATH_UPLOAD') ? null : define('PATH_UPLOAD', ROOT_DIR.PATH_CLIENT.'uploads/');
/**
 * @APPLICATION_MODE = DEV, PROD, TEST
 */
define('APPLICATION_MODE', 'DEV');
define('APPLICATION_VERSION', 'v2.6.0');
define('APPLICATION_NAME', 'Co-Market');

defined('PATH_LOGS') ? null : define('PATH_LOGS', ROOT_DIR.PATH_SERVER.'logs/');
isset($_SERVER['SERVER_NAME']) ? define('WEB_SHOP_URL', 'http://' .$_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']. 'Json') : define('WEB_SHOP_URL', '');
defined('DASH_KEY') ? null : define('DASH_KEY', 'XX12345ZXC98765MNBV');

if(APPLICATION_MODE === 'PROD'){
    defined('SENDGRID_API_KEY') ? null : define('SENDGRID_API_KEY','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');
}else if(APPLICATION_MODE === 'TEST'){
    defined('SENDGRID_API_KEY') ? null : define('SENDGRID_API_KEY','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');
}else{
    defined('SENDGRID_API_KEY') ? null : define('SENDGRID_API_KEY','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');
}

defined('ADMIN_MAIL') ? null : define('ADMIN_MAIL', 'dash-admin@saguaronet.ro');

if (!defined('DB_SERVER')){
    getenv('DB_SERVER') ? define('DB_SERVER', getenv('DB_SERVER')) : define('DB_SERVER', 'db');
}
if (!defined('DB_USER')){
    getenv('DB_USER') ? define('DB_USER', getenv('DB_USER')) : define('DB_USER', 'developer');
}
if (!defined('DB_PASS')){
    getenv('DB_PASS') ? define('DB_PASS', getenv('DB_PASS')) : define('DB_PASS', 'developer');
}
if (!defined('DB_NAME')){
    getenv('DB_NAME') ? define('DB_NAME', getenv('DB_NAME')) : define('DB_NAME', 'ricoh_dash');
}

const TABLES = array(
    'brokers' => 'brokers',
    'broker_commission_split' => 'broker_commission_split',
    'billing_information' => 'billing_information',
    'dashboards' => 'dashboards',
    'delivery_addresses' => 'delivery_addresses',
    'countries' => 'countries',
    'company' => 'company',
    'customers' => 'customers',
    'commercial_leads' => 'commercial_leads',
    'documents' => 'documents',
    'document_types' => 'document_types',
    'financing' => 'financing',
    'gadgets' => 'gadgets',
    'installation_schedule_dates' => 'installation_schedule_dates',
    'installation_company_selections' => 'installation_company_selections',
    'order_types' =>'order_types',
    'modules' => 'modules',
    'web_shop_cart' => 'web_shop_cart',
    'web_shop_cart_extra_packages' => 'web_shop_cart_extra_packages',
    'suppliers' => 'suppliers',
    'supplier_bids' => 'supplier_bids',
    'payment_types' => 'payment_types',
    'options' => 'options',
    'packages' => 'packages',
    'packages_bids' => 'packages_bids',
    'package_option_groups' => 'package_option_groups',
    'package_types' => 'package_types',
    'products' => 'virtual_products',
    'processes' => 'processes',
    'process_step' => 'process_step',
    'process_step_actions' => 'process_step_actions',
    'price_list_broker' => 'price_list_broker',
    'price_list_commercial_lead' => 'price_list_commercial_lead',
    'price_list_default_commercial_lead' => 'price_list_default_commercial_lead',
    'option_values' => 'option_values',
    'order_selections' => 'order_selections',
    'order_statuses' => 'order_statuses',
    'order_projects' => 'order_projects',
    'orders' => 'orders',
    'suppliers_countries_products' => 'suppliers_countries_products',
    'package_items' => 'package_items',
    'rel_commercial_lead_customers' => 'rel_commercial_lead_customers',
    'rel_package_products' => 'rel_package_products',
    'packages_templates' => 'packages_templates',
    'rel_additional_packages' => 'rel_additional_packages',
    'rel_bid_supplier_bids' => 'rel_bid_supplier_bids',
    'rel_customer_discount' => 'rel_customer_discount',
    'rel_package_options' => 'rel_package_options',
    'rel_package_documents' => 'rel_package_documents',
    'rel_package_product_template' => 'rel_package_product_template',
    'rel_package_processes' => 'rel_package_processes',
    'rel_group_options' => 'rel_group_options',
    'rel_product_documents' => 'rel_product_documents',
    'rel_process_steps' => 'rel_process_steps',
    'rel_order_comments' => 'rel_order_comments',
    'rel_order_documents' => 'rel_order_documents',
    'rel_order_extra_packages' => 'rel_order_extra_packages',
    'rel_order_scheduled_dates' => 'rel_order_scheduled_dates',
    'rel_order_schedules_confirmations' => 'rel_order_schedules_confirmations',
    'rel_order_supplier_options' => 'rel_order_supplier_options',
    'rel_order_supplier_estimations' => 'rel_order_supplier_estimations',
    'rel_order_packages' => 'rel_order_packages',
    'rel_order_process_step' => 'rel_order_process_step',
    'rel_order_products_estimation' => 'rel_order_products_estimation',
    'rel_step_comments' => 'rel_step_comments',
    'rel_user_type' => 'rel_user_type',
    'rel_user_types_modules' => 'rel_user_types_modules',
    'rel_user_types_gadgets' => 'rel_user_types_gadgets',
    'rel_dashboard_gadgets' => 'rel_dashboard_gadgets',
    'terms' => 'terms',
    'user_types' => 'user_types',
    'users' => 'users',
    'product_types' => 'product_types',
    'product_categories' => 'product_categories',
    'support' => 'support',
    'system_allowed_languages' => 'system_allowed_languages'
);

const USER_TYPES = array(
    'BROKER' => 'broker',
    'CUSTOMER' => 'customer',
    'COMMERCIAL_LEAD' => 'commercial_lead',
    'SUPPLIER' => 'supplier'
);

const ADDITIONAL_MAX_INSTALL_DAYS = 10;

if(APPLICATION_MODE === 'PROD'){
    defined('CLOUDINARY_NAME') ? null : define('CLOUDINARY_NAME', 'co-market');
    defined('CLOUDINARY_API_KEY') ? null : define('CLOUDINARY_API_KEY', '259788629478527');
    defined('CLOUDINARY_API_SECRET') ? null : define('CLOUDINARY_API_SECRET', 'vpzOZUPhh6Gf2OMKMkZCE8Spjds');
} else {
    defined('CLOUDINARY_NAME') ? null : define('CLOUDINARY_NAME', 'co-market-team');
    defined('CLOUDINARY_API_KEY') ? null : define('CLOUDINARY_API_KEY', '778788918828841');
    defined('CLOUDINARY_API_SECRET') ? null : define('CLOUDINARY_API_SECRET', 'V7QJggnVrHJxWOp_qB-o8mSVIlk');
}
const IMAGE_URL = "https://res.cloudinary.com/".CLOUDINARY_NAME."/image/upload/";

const SUPPORT_MAIL_LIST = array(
    'rikard@co-ideation.com'
);

const SESSION_LIFE_TIME = 60 * 24;

if (!defined('WIAAS_URL')){
    getenv('WIAAS_URL') ? define('WIAAS_URL', $_ENV['WIAAS_URL']) : define('WIAAS_URL', 'http://localhost:8000');
}

const WIAAS_URL = APPLICATION_MODE === 'PROD' ? 'http://localhost:8000' : 'http://localhost:8000';
const WORKING_DAYS_KEY = 'you@gmail.com';
const JWT_API_SECRET_KEY = 'W11A$_AP1_S3CR3T';
const JWT_ALGORITHM ='HS512';
const JWT_MAX_LIFE = 60*60; // 1 hour token

const DETECT_LANGUAGE_API_URL = 'https://ws.detectlanguage.com/0.2/detect';
const DETECT_LANGUAGE_API_KEY = 'f667fb2f1c8a5b1dac2af6dd2d001a6e';
const STRING_START = '#str#';
