/*
	Licensed Material - Property of IBM

	(C) Copyright 2015, 2016 IBM Corp.

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/


/*jslint node:true */
/*jshint node:true */

'use strict';

var path = require('path');

function define(name, value) {
    Object.defineProperty(exports, name, {
        value: value,
        enumerable: true
    });
}

// Module name
define('MODULE', 'app-preview');

// Gaze callbacks
define('GAZE_CHANGED', 'changed');
define('GAZE_ADDED', 'added');
define('GAZE_RENAMED', 'renamed');
define('GAZE_DELETED', 'deleted');
define('GAZE_ALL', 'all');

// Preview callbacks
define('PREVIEW_RELOAD', 'reload');
define('PREVIEW_START', 'start');
define('PREVIEW_ERROR', 'error');

// Platform consts
define('ANDROID', 'android');
define('IOS', 'ios');
define('WIN', 'windows');
define('IOS_IPHONE', 'ios.iphone');
define('WIN_PHONE', 'windowsphone');

// Path consts
define('ANDROID_DIR', path.join('platforms', 'android'));
// Android dir constant for cordova-android version >= 7
define('ANDROID_GT_EQ_7', path.join('platforms', 'android', 'app', 'src', 'main'));
define('IOS_DIR', path.join('platforms', 'ios'));
define('WIN_DIR', path.join('platforms', 'windows'));
define('BROWSER_DIR', path.join('platforms', 'browser'));
define('WWW_WATCH_DIR', path.join('www', '**', '*'));
define('WWW_DIR', 'www');
define('ASSETS_DIR', 'assets');
define('SERVE_TIME_PATH', path.join('platforms', 'serve-time.txt'));

// Cordova consts
define('CORDOVA_CMD', 'cordova');
define('PREPARE_ARG', 'prepare');
define('PREVIEW_ARG', '--preview');
define('SILLY_ARG', '-dd');
define('VERBOSE_ARG', '-d');

// Log levels
define('SILLY_LEVEL', 'silly');
define('VERBOSE_LEVEL', 'verbose');

// Server
define('DEFAULT_PORT', 10081);

// Preview types
define('BROWSER', 'browser');
define('MBS', 'mbs');

// Watch modes
define('WC_MODE', 'wc');
define('WP_MODE', 'wp');
define('S_MODE', 's');

// Preview arguments

define('LONG_HAND_ARGS', {
        'type': String,
        'clientid':String,
        'secret':String,
        'watch+copy': Boolean,
        'watch+prepare': Boolean,
        'serve': Boolean
    }
);

define('SHORT_HAND_ARGS', {
        t: '--type',
        wc: '--watch+copy',
        wp: '--watch+prepare',
        s: '--serve'
    }
);

define('REWRITE_RULES', [{
  // Override CSP so browserSync can inject script during preview
  match: /Content-Security-Policy/,
  fn: function () { return ""; }
}]);
