import { join } from 'path';

export const HTTP = Object.freeze({
  CDN: 'https://cdn.vizality.com',
  WEBSITE: 'https://vizality.com',
  TRELLO: 'https://trello.com/vizality',
  API: 'https://api.vizality.com',
  get DOCS () { return `${this.WEBSITE}/docs`; },
  get ASSETS () { return `${this.CDN}/assets`; }
});

export const Protocols = Object.freeze({
  BASE: 'vizality://',
  get ASSETS () { return `${this.BASE}assets`; },
  get THEMES () { return `${this.BASE}themes`; },
  get PLUGINS () { return `${this.BASE}plugins`; },
  get BUILTINS () { return `${this.BASE}builtins`; }
});

export const Repositories = Object.freeze({
  ORG: 'vizality',
  get VIZALITY () { return `${this.ORG}/vizality`; },
  get COMMUNITY () { return `${this.ORG}/community`; }
});

export const Directories = Object.freeze({
  ROOT: join(__dirname, '..', '..', '..', '..'),
  get SRC () { return join(this.ROOT, 'renderer', 'src'); },
  get SETTINGS () { return join(this.ROOT, 'settings'); },
  get ASSETS () { return join(this.ROOT, 'assets'); },
  get CACHE () { return join(this.ROOT, '.cache'); },
  get LOGS () { return join(this.ROOT, '.logs'); },
  get ADDONS () { return join(this.ROOT, 'addons'); },
  get PLUGINS () { return join(this.ADDONS, 'plugins'); },
  get BUILTINS () { return join(this.SRC, 'builtins'); },
  get THEMES () { return join(this.ADDONS, 'themes'); },
  get API () { return join(this.SRC, 'api'); },
  get LOCALES () { return join(this.SRC, 'locales'); },
  get MANAGERS () { return join(this.SRC, 'managers'); },
  get STYLES () { return join(this.SRC, 'styles'); },
  get MODULES () { return join(__dirname, '..'); }
});

export const Guild = Object.freeze({
  INVITE: 'Fvmsfv2',
  ID: '689933814864150552'
});

export const Channels = Object.freeze({
  CSS_SNIPPETS: '705262981214371902',
  JS_SNIPPETS: '705262981214371902',
  PLUGINS: '700461738004578334',
  THEMES: '700461710972157954',
  DEVELOPMENT: '690452269753171998',
  STAFF: '690452551233175602',
  INSTALLATION_SUPPORT: '718478897695424613',
  PLUGINS_SUPPORT: '705264484528291956',
  THEMES_SUPPORT: '705264431831187496',
  MISC_SUPPORT: '705264513728905266'
});

// @todo These need proper testing and more added.
export const Regexes = Object.freeze({
  DISCORD: '^(https?://)?(canary.|ptb.)?discord(?:app)?.com',
  get INVITE () { return `${this.DISCORD}/invite|.gg)/[a-zA-Z1-9]{2,}`; },
  // eslint-disable-next-line no-useless-escape
  get MESSAGE_LINK () { return `${this.DISCORD}/channels/(?:@me|\d{17,19}/)?\d{17,19}/\d{17,19}`; },
  get ASSET_LINK () { return `(?:${this.DISCORD})?/assets/(?:[0-9].)?[a-zA-Z0-9]{20,32}.?[a-z]{2,5}`; },
  // eslint-disable-next-line no-useless-escape
  EMOJI: '(:|<:|<a:)((\w{1,64}:\d{17,18})|(\w{1,64}))(:|>)',
  USER_ID: '^(\\d{17,19})$',
  USER_MENTION: '^<@!?(\\d+)>$',
  CHANNEL_MENTION: '^<#!?(\\d+)>$'
});

export const Events = Object.freeze({
  /**
   * Vizality Settings
   */
  VIZALITY_READY: 'VIZALITY_READY',
  VIZALITY_SETTINGS_READY: 'VIZALITY_SETTINGS_READY',
  VIZALITY_SETTING_UPDATE: 'VIZALITY_SETTING_UPDATE',
  VIZALITY_SETTING_TOGGLE: 'VIZALITY_SETTING_TOGGLE',

  /**
   * Addons
   */
  VIZALITY_ADDON_SETTINGS_REGISTER: 'VIZALITY_ADDON_SETTINGS_REGISTER',
  VIZALITY_ADDON_SETTINGS_UNREGISTER: 'VIZALITY_ADDON_SETTINGS_UNREGISTER',
  VIZALITY_ADDON_SETTING_UPDATE: 'VIZALITY_ADDON_SETTING_UPDATE',
  VIZALITY_ADDON_SETTING_TOGGLE: 'VIZALITY_ADDON_SETTING_TOGGLE',
  VIZALITY_ADDON_UNINSTALL_CONFIRM: 'VIZALITY_ADDON_UNINSTALL_CONFIRM',
  VIZALITY_ADDON_UNINSTALL: 'VIZALITY_ADDON_UNINSTALL',
  VIZALITY_ADDON_INSTALL_CONFIRM: 'VIZALITY_ADDON_INSTALL_CONFIRM',
  VIZALITY_ADDON_INSTALL: 'VIZALITY_ADDON_INSTALL',
  VIZALITY_ADDON_ENABLE: 'VIZALITY_ADDON_ENABLE',
  VIZALITY_ADDON_DISABLE: 'VIZALITY_ADDON_DISABLE',
  VIZALITY_ADDON_TOGGLE: 'VIZALITY_ADDON_TOGGLE',
  VIZALITY_ADDONS_READY: 'VIZALITY_ADDONS_READY',

  /**
   * Vizality APIs
   */
  VIZALITY_ACTION_ADD: 'VIZALITY_ACTION_ADD',
  VIZALITY_ACTION_REMOVE: 'VIZALITY_ACTION_REMOVE',
  VIZALITY_ACTION_REMOVE_ALL: 'VIZALITY_ACTION_REMOVE_ALL',
  VIZALITY_ACTION_REMOVE_ALL_BY_CALLER: 'VIZALITY_ACTION_REMOVE_ALL_BY_CALLER',
  VIZALITY_COMMAND_ADD: 'VIZALITY_COMMAND_ADD',
  VIZALITY_COMMAND_REMOVE: 'VIZALITY_COMMAND_REMOVE',
  VIZALITY_COMMAND_REMOVE_ALL: 'VIZALITY_COMMAND_REMOVE_ALL',
  VIZALITY_COMMAND_REMOVE_ALL_BY_CALLER: 'VIZALITY_COMMAND_REMOVE_ALL_BY_CALLER',
  VIZALITY_ROUTE_ADD: 'VIZALITY_ROUTE_ADD',
  VIZALITY_ROUTE_REMOVE: 'VIZALITY_ROUTE_REMOVE',
  VIZALITY_ROUTE_REMOVE_ALL: 'VIZALITY_ROUTE_REMOVE_ALL',
  VIZALITY_ROUTE_REMOVE_ALL_BY_CALLER: 'VIZALITY_ROUTE_REMOVE_ALL_BY_CALLER',
  VIZALITY_KEYBIND_ADD: 'VIZALITY_KEYBIND_ADD',
  VIZALITY_KEYBIND_REMOVE: 'VIZALITY_KEYBIND_REMOVE',
  VIZALITY_KEYBIND_REMOVE_ALL: 'VIZALITY_KEYBIND_REMOVE_ALL',
  VIZALITY_KEYBIND_REMOVE_ALL_BY_CALLER: 'VIZALITY_KEYBIND_REMOVE_ALL_BY_CALLER',
  VIZALITY_NOTICE_SEND: 'VIZALITY_NOTICE_SEND',
  VIZALITY_NOTICE_CLOSE: 'VIZALITY_NOTICE_CLOSE',
  VIZALITY_NOTICE_CLOSE_ALL: 'VIZALITY_NOTICE_CLOSE_ALL',
  VIZALITY_NOTICE_CLOSE_ALL_BY_CALLER: 'VIZALITY_NOTICE_CLOSE_ALL_BY_CALLER',
  VIZALITY_TOAST_SEND: 'VIZALITY_TOAST_SEND',
  VIZALITY_TOAST_CLOSE: 'VIZALITY_TOAST_CLOSE',
  VIZALITY_TOAST_CLOSE_ALL: 'VIZALITY_TOAST_CLOSE_ALL',
  VIZALITY_TOAST_CLOSE_ALL_QUEUED: 'VIZALITY_TOAST_CLOSE_ALL_QUEUED',
  VIZALITY_TOAST_CLOSE_ALL_ACTIVE: 'VIZALITY_TOAST_CLOSE_ALL_ACTIVE',
  VIZALITY_TOAST_CLOSE_ALL_BY_CALLER: 'VIZALITY_TOAST_CLOSE_ALL_BY_CALLER',
  VIZALITY_POPUP_WINDOW_OPEN: 'VIZALITY_POPUP_WINDOW_OPEN',
  VIZALITY_POPUP_WINDOW_CLOSE: 'VIZALITY_POPUP_WINDOW_CLOSE'
});

export const Avatars = Object.freeze({
  get DEFAULT_THEME_1 () { return `${Protocols.ASSETS}/images/default-theme-1.png`; },
  get DEFAULT_THEME_2 () { return `${Protocols.ASSETS}/images/default-theme-2.png`; },
  get DEFAULT_THEME_3 () { return `${Protocols.ASSETS}/images/default-theme-3.png`; },
  get DEFAULT_THEME_4 () { return `${Protocols.ASSETS}/images/default-theme-4.png`; },
  get DEFAULT_THEME_5 () { return `${Protocols.ASSETS}/images/default-theme-5.png`; },
  // ---
  get DEFAULT_PLUGIN_1 () { return `${Protocols.ASSETS}/images/default-plugin-1.png`; },
  get DEFAULT_PLUGIN_2 () { return `${Protocols.ASSETS}/images/default-plugin-2.png`; },
  get DEFAULT_PLUGIN_3 () { return `${Protocols.ASSETS}/images/default-plugin-3.png`; },
  get DEFAULT_PLUGIN_4 () { return `${Protocols.ASSETS}/images/default-plugin-4.png`; },
  get DEFAULT_PLUGIN_5 () { return `${Protocols.ASSETS}/images/default-plugin-5.png`; }
});

export const ActionTypes = Object.freeze({
  VIZALITY_UPDATE_SETTINGS: 'VIZALITY_SETTINGS_UPDATE',
  VIZALITY_TOGGLE_SETTING: 'VIZALITY_SETTING_TOGGLE',
  VIZALITY_UPDATE_SETTING: 'VIZALITY_SETTING_UPDATE',
  VIZALITY_DELETE_SETTING: 'VIZALITY_SETTING_DELETE'
});


export const IpcEvents = Object.freeze({
  VIZALITY_WINDOW_UNMAXIMIZE: 'VIZALITY_WINDOW_UNMAXIMIZE',
  VIZALITY_WINDOW_MAXIMIZE: 'VIZALITY_WINDOW_MAXIMIZE',
  VIZALITY_WINDOW_IS_MAXIMIZED: 'VIZALITY_WINDOW_IS_MAXIMIZED'
});

export const ErrorTypes = Object.freeze({

});

export const Developers = Object.freeze([
  { username: 'dperolio', id: '97549189629636608' }
]);

export const DefaultSettings = Object.freeze({
  transparentWindow: false,
  experimentalWebPlatform: false,
  smoothScrolling: true,
  reactDeveloperTools: false,
  hotReload: false,
  replaceClyde: true
});

export default this;
