
const API_ORIGIN = window.cloudron?.apiOrigin || import.meta.env.VITE_API_ORIGIN || '';
const BASE_URL = import.meta.env.BASE_URL || '/';

// app.accessRestriction:
// null = ANY
// false = NOSSO
// { users: [], groups: [] } = RESTRICTED
const ACL_OPTIONS = Object.freeze({
  ANY: 'any',
  RESTRICTED: 'restricted',
  NOSSO: 'nosso',
});

// keep in sync with box/src/apps.js
const ISTATES = {
    PENDING_INSTALL: 'pending_install',
    PENDING_CLONE: 'pending_clone',
    PENDING_CONFIGURE: 'pending_configure',
    PENDING_UNINSTALL: 'pending_uninstall',
    PENDING_RESTORE: 'pending_restore',
    PENDING_IMPORT: 'pending_import',
    PENDING_UPDATE: 'pending_update',
    PENDING_BACKUP: 'pending_backup',
    PENDING_RECREATE_CONTAINER: 'pending_recreate_container', // env change or addon change
    PENDING_LOCATION_CHANGE: 'pending_location_change',
    PENDING_SERVICES_CHANGE: 'pending_services_change',
    PENDING_DATA_DIR_MIGRATION: 'pending_data_dir_migration',
    PENDING_RESIZE: 'pending_resize',
    PENDING_DEBUG: 'pending_debug',
    PENDING_START: 'pending_start',
    PENDING_STOP: 'pending_stop',
    PENDING_RESTART: 'pending_restart',
    ERROR: 'error',
    INSTALLED: 'installed'
};

const HSTATES = {
    HEALTHY: 'healthy',
    UNHEALTHY: 'unhealthy',
    ERROR: 'error',
    DEAD: 'dead'
};

const RSTATES ={
    RUNNING: 'running',
    STOPPED: 'stopped'
};

const ERROR = {
    ACCESS_DENIED: 'Access Denied',
    ALREADY_EXISTS: 'Already Exists',
    BAD_FIELD: 'Bad Field',
    COLLECTD_ERROR: 'Collectd Error',
    CONFLICT: 'Conflict',
    DATABASE_ERROR: 'Database Error',
    DNS_ERROR: 'DNS Error',
    DOCKER_ERROR: 'Docker Error',
    EXTERNAL_ERROR: 'External Error',
    FS_ERROR: 'FileSystem Error',
    INTERNAL_ERROR: 'Internal Error',
    LOGROTATE_ERROR: 'Logrotate Error',
    NETWORK_ERROR: 'Network Error',
    NOT_FOUND: 'Not found',
    REVERSEPROXY_ERROR: 'ReverseProxy Error',
    TASK_ERROR: 'Task Error',
    UNKNOWN_ERROR: 'Unknown Error' // only used for portin,
};

const ROLES = {
    OWNER: 'owner',
    ADMIN: 'admin',
    MAIL_MANAGER: 'mailmanager',
    USER_MANAGER: 'usermanager',
    USER: 'user'
};

// sync up with tasks.js
const TASK_TYPES = {
    TASK_APP: 'app',
    TASK_APP_BACKUP_PREFIX: 'appBackup_',
    TASK_FULL_BACKUP_PREFIX: 'backup_', // full backup
    TASK_CLEAN_BACKUPS_PREFIX: 'cleanBackups_',
    TASK_UPDATE: 'boxUpdate',
    TASK_CHECK_BACKUP_INTEGRITY: 'checkBackupIntegrity',
    TASK_CHECK_CERTS: 'checkCerts',
    TASK_PREPARE_DASHBOARD_LOCATION: 'prepareDashboardLocation',
    TASK_CLEAN_BACKUPS: 'cleanBackups',
    TASK_SYNC_EXTERNAL_LDAP: 'syncExternalLdap',
    TASK_CHANGE_MAIL_LOCATION: 'changeMailLocation',
    TASK_SYNC_DNS_RECORDS: 'syncDnsRecords',
    TASK_SYNC_DYNDNS: 'syncDyndns',
    TASK_UPDATE_DISK_USAGE: 'updateDiskUsage',
};

const APP_TYPES = {
    APP: 'app', //default
    LINK: 'link',
    PROXIED: 'proxied'
};

const PROXY_APP_ID = 'io.cloudron.builtin.appproxy';

// sync up with tokens.js
const TOKEN_TYPES = {
    ID_WEBADMIN: 'cid-webadmin',        // dashboard
    ID_DEVELOPMENT: 'cid-development',  // dashboard development
    ID_CLI: 'cid-cli',                  // cloudron cli
    ID_SDK: 'cid-sdk',                  // created by user via dashboard
};

const ENDPOINTS_OVH = [
    { name: 'OVH Europe', value: 'ovh-eu' },
    { name: 'OVH US', value: 'ovh-us' },
    { name: 'OVH North-America', value: 'ovh-ca' },
    { name: 'SoYouStart Europe', value: 'soyoustart-eu' },
    { name: 'SoYouStart North-America', value: 'soyoustart-ca' },
    { name: 'Kimsufi Europe', value: 'kimsufi-eu' },
    { name: 'Kimsufi North-America', value: 'kimsufi-ca' },
];

// List is from http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
const REGIONS_S3 = [
    { name: 'Africa (Cape Town)', value: 'af-south-1' },
    { name: 'Asia Pacific (Hong Kong)', value: 'ap-east-1' },
    { name: 'Asia Pacific (Hyderabad)', value: 'ap-south-2' },
    { name: 'Asia Pacific (Jakarta)', value: 'ap-southeast-3' },
    { name: 'Asia Pacific (Melbourne)', value: 'ap-southeast-4' },
    { name: 'Asia Pacific (Mumbai)', value: 'ap-south-1' },
    { name: 'Asia Pacific (Osaka)', value: 'ap-northeast-3' },
    { name: 'Asia Pacific (Seoul)', value: 'ap-northeast-2' },
    { name: 'Asia Pacific (Singapore)', value: 'ap-southeast-1' },
    { name: 'Asia Pacific (Sydney)', value: 'ap-southeast-2' },
    { name: 'Asia Pacific (Tokyo)', value: 'ap-northeast-1' },
    { name: 'Canada (Central)', value: 'ca-central-1' },
    { name: 'China (Beijing)', value: 'cn-north-1' },
    { name: 'China (Ningxia)', value: 'cn-northwest-1' },
    { name: 'Middle East (Bahrain)', value: 'me-south-1' },
    { name: 'Middle East (UAE)', value: 'me-central-1' },
    { name: 'EU (Frankfurt)', value: 'eu-central-1' },
    { name: 'EU (Ireland)', value: 'eu-west-1' },
    { name: 'EU (London)', value: 'eu-west-2' },
    { name: 'EU (Milan)', value: 'eu-south-1' },
    { name: 'EU (Paris)', value: 'eu-west-3' },
    { name: 'EU (Spain)', value: 'eu-south-2' },
    { name: 'EU (Stockholm)', value: 'eu-north-1' },
    { name: 'EU (Zurich)', value: 'eu-central-2' },
    { name: 'South America (São Paulo)', value: 'sa-east-1' },
    { name: 'US East (N. Virginia)', value: 'us-east-1' },
    { name: 'US East (Ohio)', value: 'us-east-2' },
    { name: 'US West (N. California)', value: 'us-west-1' },
    { name: 'US West (Oregon)', value: 'us-west-2' },
];

// https://docs.wasabi.com/v1/docs/what-are-the-service-urls-for-wasabi-s-different-storage-regions
const REGIONS_WASABI = [
    // Americas
    { name: 'US East 1 (N. Virginia)', value: 'https://s3.us-east-1.wasabisys.com', region: 'us-east-1' },
    { name: 'US East 2 (N. Virginia)', value: 'https://s3.us-east-2.wasabisys.com', region: 'us-east-2' },
    { name: 'US Central 1 (Texas)', value: 'https://s3.us-central-1.wasabisys.com', region: 'us-central-1' },
    { name: 'US West 1 (Oregon)', value: 'https://s3.us-west-1.wasabisys.com', region: 'us-west-1' },
    { name: 'CA Central 1 (Toronto)', value: 'https://s3.ca-central-1.wasabisys.com', region: 'ca-central-1' },
    // EMEA
    { name: 'EU Central 1 (Amsterdam)', value: 'https://s3.eu-central-1.wasabisys.com', region: 'eu-central-1' },
    { name: 'EU Central 2 (Frankfurt)', value: 'https://s3.eu-central-2.wasabisys.com', region: 'eu-central-2' },
    { name: 'EU West 1 (United Kingdom)', value: 'https://s3.eu-west-1.wasabisys.com', region: 'eu-west-1' },
    { name: 'EU West 2 (Paris)', value: 'https://s3.eu-west-2.wasabisys.com', region: 'eu-west-2' },
    { name: 'EU West 3 (United Kingdom)', value: 'https://s3.eu-west-3.wasabisys.com', region: 'eu-west-3' },
    { name: 'EU South 1 (Milan)', value: 'https://s3.eu-south-1.wasabisys.com', region: 'eu-south-1' },
    // APAC
    { name: 'AP Northeast 1 (Tokyo)', value: 'https://s3.ap-northeast-1.wasabisys.com', region: 'ap-northeast-1' },
    { name: 'AP Northeast 2 (Osaka)', value: 'https://s3.ap-northeast-2.wasabisys.com', region: 'ap-northeast-2' },
    { name: 'AP Southeast 1 (Singapore)', value: 'https://s3.ap-southeast-1.wasabisys.com', region: 'ap-southeast-1' },
    { name: 'AP Southeast 2 (Sydney)', value: 'https://s3.ap-southeast-2.wasabisys.com', region: 'ap-southeast-2' }
];

const REGIONS_HETZNER = [
    { name: 'Falkenstein (FSN1)', value: 'https://fsn1.your-objectstorage.com' },
    { name: 'Helsinki (HEL1)', value: 'https://hel1.your-objectstorage.com' },
    { name: 'Nuremberg (NBG1)', value: 'https://nbg1.your-objectstorage.com' }
];

// https://docs.digitalocean.com/products/spaces/details/availability/
const REGIONS_DIGITALOCEAN = [
    { name: 'AMS3', value: 'https://ams3.digitaloceanspaces.com' },
    { name: 'ATL1', value: 'https://atl1.digitaloceanspaces.com' },
    { name: 'BLR1', value: 'https://blr1.digitaloceanspaces.com' },
    { name: 'FRA1', value: 'https://fra1.digitaloceanspaces.com' },
    { name: 'LON1', value: 'https://lon1.digitaloceanspaces.com' },
    { name: 'NYC3', value: 'https://nyc3.digitaloceanspaces.com' },
    { name: 'SFO2', value: 'https://sfo2.digitaloceanspaces.com' },
    { name: 'SFO3', value: 'https://sfo3.digitaloceanspaces.com' },
    { name: 'SGP1', value: 'https://sgp1.digitaloceanspaces.com' },
    { name: 'SYD1', value: 'https://syd1.digitaloceanspaces.com' },
    { name: 'TOR1', value: 'https://tor1.digitaloceanspaces.com' }
];

// https://www.exoscale.com/datacenters/
const REGIONS_EXOSCALE = [
    { name: 'Vienna (AT-VIE-1)', value: 'https://sos-at-vie-1.exo.io' },
    { name: 'Vienna (AT-VIE-2)', value: 'https://sos-at-vie-2.exo.io' },
    { name: 'Sofia (BG-SOF-1)', value: 'https://sos-bg-sof-1.exo.io' },
    { name: 'Zurich (CH-DK-2)', value: 'https://sos-ch-dk-2.exo.io' },
    { name: 'Geneva (CH-GVA-2)', value: 'https://sos-ch-gva-2.exo.io' },
    { name: 'Frankfurt (DE-FRA-1)', value: 'https://sos-de-fra-1.exo.io' },
    { name: 'Munich (DE-MUC-1)', value: 'https://sos-de-muc-1.exo.io' },
];

// https://www.scaleway.com/docs/object-storage-feature/
const REGIONS_SCALEWAY = [
    { name: 'Paris (FR-PAR)', value: 'https://s3.fr-par.scw.cloud', region: 'fr-par' }, // default
    { name: 'Amsterdam (NL-AMS)', value: 'https://s3.nl-ams.scw.cloud', region: 'nl-ams' },
    { name: 'Warsaw (PL-WAW)', value: 'https://s3.pl-waw.scw.cloud', region: 'nl-ams' }
];

// https://www.linode.com/docs/products/storage/object-storage/guides/urls/
const REGIONS_LINODE = [
    { name: 'Amsterdam', value: 'https://nl-ams-1.linodeobjects.com', region: 'nl-ams-1' },
    { name: 'Atlanta', value: 'https://us-southeast-1.linodeobjects.com', region: 'us-southeast-1' },
    { name: 'Chennai', value: 'https://in-maa-1.linodeobjects.com', region: 'in-maa-1' },
    { name: 'Chicago', value: 'https://us-ord-1.linodeobjects.com', region: 'us-ord-1' },
    { name: 'Frankfurt', value: 'https://eu-central-1.linodeobjects.com', region: 'eu-central-1' },
    { name: 'London', value: 'https://gb-lon-1.linodeobjects.com', region: 'gb-lon-1' },
    { name: 'Jakarta', value: 'https://id-cgk-1.linodeobjects.com', region: 'id-cgk-1' },
    { name: 'Los Angeles, CA (USA)', value: 'https://us-lax-1.linodeobjects.com', region: 'us-lax-1' },
    { name: 'Miami', value: 'https://us-mia-1.linodeobjects.com', region: 'us-mia-1' },
    { name: 'Milan', value: 'https://it-mil-1.linodeobjects.com', region: 'it-mil-1' },
    { name: 'Newark', value: 'https://us-east-1.linodeobjects.com', region: 'us-east-1' }, // default
    { name: 'Osaka', value: 'https://jp-osa-1.linodeobjects.com', region: 'jp-osa-1' },
    { name: 'Paris', value: 'https://fr-par-1.linodeobjects.com', region: 'fr-par-1' },
    { name: 'Sao Paulo', value: 'https://br-gru-1.linodeobjects.com', region: 'br-gru-1' },
    { name: 'Seattle', value: 'https://us-sea-1.linodeobjects.com', region: 'us-sea-1' },
    { name: 'Singapore', value: 'https://ap-south-1.linodeobjects.com', region: 'ap-south-1' },
    { name: 'Stockholm', value: 'https://se-sto-1.linodeobjects.com', region: 'se-sto-1' },
    { name: 'Washington', value: 'https://us-iad-1.linodeobjects.com', region: 'us-iad-1' },
];

// note: ovh also has a storage endpoint but that only supports path style access (https://docs.ovh.com/au/en/storage/object-storage/s3/location/)
const REGIONS_OVH = [
    { name: 'Beauharnois (BHS)', value: 'https://s3.bhs.io.cloud.ovh.net', region: 'bhs' }, // default
    { name: 'Frankfurt (DE)', value: 'https://s3.de.io.cloud.ovh.net', region: 'de' },
    { name: 'Gravelines (GRA)', value: 'https://s3.gra.io.cloud.ovh.net', region: 'gra' },
    { name: 'Roubaix (RBX)', value: 'https://s3.rbx.io.cloud.ovh.net', region: 'rbx' },
    { name: 'Strasbourg (SBG)', value: 'https://s3.sbg.io.cloud.ovh.net', region: 'sbg' },
    { name: 'London (UK)', value: 'https://s3.uk.io.cloud.ovh.net', region: 'uk' },
    { name: 'Sydney (SYD)', value: 'https://s3.syd.io.cloud.ovh.net', region: 'syd' },
    { name: 'Warsaw (WAW)', value: 'https://s3.waw.io.cloud.ovh.net', region: 'waw' },
];

// https://docs.ionos.com/cloud/managed-services/s3-object-storage/endpoints
const REGIONS_IONOS = [
    { name: 'Berlin (eu-central-3)', value: 'https://s3.eu-central-3.ionoscloud.com', region: 'de' }, // default. contract-owned
    { name: 'Frankfurt (DE)', value: 'https://s3.eu-central-1.ionoscloud.com', region: 'de' },
    { name: 'Berlin (eu-central-2)', value: 'https://s3-eu-central-2.ionoscloud.com', region: 'eu-central-2' },
    { name: 'Logrono (eu-south-2)', value: 'https://s3-eu-south-2.ionoscloud.com', region: 'eu-south-2' },
];

// this is not used anywhere because upcloud needs endpoint URL. we detect region from the URL (https://upcloud.com/data-centres)
const REGIONS_UPCLOUD = [
    { name: 'AU-SYD1 (Australia)', value: 'https://au-syd1.upcloudobjects.com', region: 'au-syd1' }, // default
    { name: 'DE-FRA1 (Germany)', value: 'https://de-fra1.upcloudobjects.com', region: 'de-fra1' },
    { name: 'ES-MAD1 (Spain)', value: 'https://es-mad1.upcloudobjects.com', region: 'es-mad1' },
    { name: 'FI-HEL2 (Finland)', value: 'https://fi-hel2.upcloudobjects.com', region: 'fi-hel2' },
    { name: 'NL-AMS1 (Netherlands)', value: 'https://nl-ams1.upcloudobjects.com', region: 'nl-ams1' },
    { name: 'PL-WAW1 (Poland)', value: 'https://pl-waw1.upcloudobjects.com', region: 'pl-waw1' },
    { name: 'SG-SIN1 (Singapore)', value: 'https://sg-sin1.upcloudobjects.com', region: 'sg-sin1' },
    { name: 'UK-LON1 (United Kingdom)', value: 'https://uk-lon1.upcloudobjects.com', region: 'uk-lon1' },
    { name: 'US-CHI1 (USA)', value: 'https://us-chi1.upcloudobjects.com', region: 'us-chi1' },
    { name: 'US-NYC1 (USA)', value: 'https://us-nyc1.upcloudobjects.com', region: 'us-nyc1' },
    { name: 'US-SJO1 (USA)', value: 'https://us-sjo1.upcloudobjects.com', region: 'us-sjo1' },
];

// region is ignored in vultr (https://www.vultr.com/docs/vultr-object-storage/)
const REGIONS_VULTR = [
    { name: 'Amsterdam', value: 'https://ams1.vultrobjects.com', region: 'eu-central-1' },
    { name: 'Bangalore', value: 'https://blr1.vultrobjects.com', region: 'ap-south-1' },
    { name: 'New Jersey', value: 'https://ewr1.vultrobjects.com', region: 'us-east-1' },
    { name: 'Silicon Valley', value: 'https://sjc1.vultrobjects.com', region: 'us-west-1' },
    { name: 'Singapore', value: 'https://sgp1.vultrobjects.com', region: 'ap-southeast-1' },
];

// https://docs.contabo.com/docs/products/Object-Storage/s3-connection-settings
const REGIONS_CONTABO = [
    { name: 'European Union (Germany)', value: 'https://eu2.contabostorage.com' , region: 'us-east-1' },
    { name: 'Singapore', value: 'https://sin1.contabostorage.com' , region: 'us-east-1' },
    { name: 'United States', value: 'https://usc1.contabostorage.com' , region: 'us-east-1' }
];

const STORAGE_PROVIDERS = [
    { name: 'Amazon S3', value: 's3', regions: REGIONS_S3 },
    { name: 'Backblaze B2 (S3 API)', value: 'backblaze-b2' },
    { name: 'CIFS Mount', value: 'cifs' },
    { name: 'Cloudflare R2', value: 'cloudflare-r2' },
    { name: 'Contabo Object Storage', value: 'contabo-objectstorage', regions: REGIONS_CONTABO },
    { name: 'DigitalOcean Spaces', value: 'digitalocean-spaces', regions: REGIONS_DIGITALOCEAN },
    { name: 'External/Local Disk (EXT4 or XFS)', value: 'disk' },
    { name: 'EXT4 Disk', value: 'ext4' },
    { name: 'Exoscale SOS', value: 'exoscale-sos', regions: REGIONS_EXOSCALE },
    { name: 'Filesystem', value: 'filesystem' },
    { name: 'Filesystem (Mount point)', value: 'mountpoint' }, // legacy
    { name: 'Google Cloud Storage', value: 'gcs' },
    { name: 'Hetzner Object Storage', value: 'hetzner-objectstorage', regions: REGIONS_HETZNER },
    { name: 'IDrive e2', value: 'idrive-e2' },
    { name: 'IONOS (Profitbricks)', value: 'ionos-objectstorage', regions: REGIONS_IONOS },
    { name: 'Linode Object Storage', value: 'linode-objectstorage', regions: REGIONS_LINODE },
    { name: 'Minio', value: 'minio' },
    { name: 'NFS Mount', value: 'nfs' },
    { name: 'OVH Object Storage', value: 'ovh-objectstorage', regions: REGIONS_OVH },
    { name: 'S3 API Compatible (v4)', value: 's3-v4-compat' },
    { name: 'Scaleway Object Storage', value: 'scaleway-objectstorage', regions: REGIONS_SCALEWAY },
    { name: 'SSHFS Mount', value: 'sshfs' },
    { name: 'Synology C2', value: 'synology-c2-objectstorage' },
    { name: 'UpCloud Object Storage', value: 'upcloud-objectstorage' },
    { name: 'Vultr Object Storage', value: 'vultr-objectstorage', regions: REGIONS_VULTR },
    { name: 'Wasabi', value: 'wasabi', regions: REGIONS_WASABI },
    { name: 'XFS Disk', value: 'xfs' },
];

const BACKUP_FORMATS = [
    { name: 'Tarball (zipped)', value: 'tgz' },
    { name: 'rsync', value: 'rsync' }
];

const RELAY_PROVIDERS = [
  { provider: 'cloudron-smtp', name: 'Built-in SMTP server' },
  { provider: 'external-smtp', name: 'External SMTP server', host: '', port: 587 },
  { provider: 'external-smtp-noauth', name: 'External SMTP server (No Authentication)', host: '', port: 587 },
  { provider: 'ses-smtp', name: 'Amazon SES', host: 'email-smtp.us-east-1.amazonaws.com', port: 587, spfDoc: 'https://docs.aws.amazon.com/ses/latest/DeveloperGuide/spf.html' },
  { provider: 'brevo-smtp', name: 'Brevo', host: 'smtp-relay.brevo.com', port: 587, spfDoc: 'https://help.brevo.com/hc/en-us/articles/12163873383186-Authenticate-your-domain-with-Brevo-Brevo-code-DKIM-DMARC' },
  { provider: 'elasticemail-smtp', name: 'Elastic Email', host: 'smtp.elasticemail.com', port: 587, spfDoc: 'https://elasticemail.com/blog/marketing_tips/common-spf-errors' },
  { provider: 'google-smtp', name: 'Google', host: 'smtp.gmail.com', port: 587, spfDoc: 'https://support.google.com/a/answer/33786?hl=en' },
  { provider: 'mailgun-smtp', name: 'Mailgun', host: 'smtp.mailgun.org', port: 587, spfDoc: 'https://www.mailgun.com/blog/white-labeling-dns-records-your-customers-tips-tricks' },
  { provider: 'mailjet-smtp', name: 'Mailjet', host: 'in-v3.mailjet.com', port: 587, spfDoc: 'https://app.mailjet.com/docs/spf-dkim-guide' },
  { provider: 'office365-legacy-smtp', name: 'Office 365', host: 'smtp-legacy.office365.com', port: 587 }, // uses "login" AUTH instead of "plain"
  { provider: 'postmark-smtp', name: 'Postmark', host: 'smtp.postmarkapp.com', port: 587, spfDoc: 'https://postmarkapp.com/support/article/1092-how-do-i-set-up-spf-for-postmark' },
  { provider: 'sendgrid-smtp', name: 'SendGrid', host: 'smtp.sendgrid.net', port: 587, username: 'apikey', spfDoc: 'https://sendgrid.com/docs/ui/account-and-settings/spf-records/' },
  { provider: 'sparkpost-smtp', name: 'SparkPost', host: 'smtp.sparkpostmail.com', port: 587, username: 'SMTP_Injection', spfDoc: 'https://www.sparkpost.com/resources/email-explained/spf-sender-policy-framework/' },
  { provider: 'noop', name: 'Disable outgoing email' },
];

// keep in sync with src/eventlog.js
const EVENTS = Object.freeze({
    ACTIVATE: 'cloudron.activate',
    PROVISION: 'cloudron.provision',
    RESTORE: 'cloudron.restore',
    START: 'cloudron.start',
    UPDATE: 'cloudron.update',
    UPDATE_FINISH: 'cloudron.update.finish',
    INSTALL_FINISH: 'cloudron.install.finish',

    APP_CLONE: 'app.clone',
    APP_CONFIGURE: 'app.configure',
    APP_REPAIR: 'app.repair',
    APP_INSTALL: 'app.install',
    APP_RESTORE: 'app.restore',
    APP_IMPORT: 'app.import',
    APP_UNINSTALL: 'app.uninstall',
    APP_UPDATE: 'app.update',
    APP_UPDATE_FINISH: 'app.update.finish',
    APP_BACKUP: 'app.backup',
    APP_BACKUP_FINISH: 'app.backup.finish',
    APP_LOGIN: 'app.login',
    APP_OOM: 'app.oom',
    APP_UP: 'app.up',
    APP_DOWN: 'app.down',
    APP_START: 'app.start',
    APP_STOP: 'app.stop',
    APP_RESTART: 'app.restart',

    ARCHIVES_ADD: 'archives.add',
    ARCHIVES_DEL: 'archives.del',

    BACKUP_FINISH: 'backup.finish',
    BACKUP_START: 'backup.start',
    BACKUP_CLEANUP_START: 'backup.cleanup.start',
    BACKUP_CLEANUP_FINISH: 'backup.cleanup.finish',
    BACKUP_INTEGRITY_START: 'backup.integrity.start',
    BACKUP_INTEGRITY_FINISH: 'backup.integrity.finish',

    BACKUP_SITE_ADD: 'backupsite.add',
    BACKUP_SITE_REMOVE: 'backupsite.remove',
    BACKUP_SITE_UPDATE: 'backupsite.update',

    BRANDING_NAME: 'branding.name',
    BRANDING_FOOTER: 'branding.footer',
    BRANDING_AVATAR: 'branding.avatar',

    CERTIFICATE_NEW: 'certificate.new',
    CERTIFICATE_RENEWAL: 'certificate.renew',
    CERTIFICATE_CLEANUP: 'certificate.cleanup',

    DASHBOARD_DOMAIN_UPDATE: 'dashboard.domain.update',

    DIRECTORY_SERVER_CONFIGURE: 'directoryserver.configure',

    DOMAIN_ADD: 'domain.add',
    DOMAIN_UPDATE: 'domain.update',
    DOMAIN_REMOVE: 'domain.remove',

    EXTERNAL_LDAP_CONFIGURE: 'externalldap.configure',

    GROUP_ADD: 'group.add',
    GROUP_REMOVE: 'group.remove',
    GROUP_UPDATE: 'group.update',
    GROUP_MEMBERSHIP: 'group.membership',

    MAIL_LOCATION: 'mail.location',
    MAIL_ENABLED: 'mail.enabled',
    MAIL_DISABLED: 'mail.disabled',
    MAIL_MAILBOX_ADD: 'mail.box.add',
    MAIL_MAILBOX_REMOVE: 'mail.box.remove',
    MAIL_MAILBOX_UPDATE: 'mail.box.update',
    MAIL_LIST_ADD: 'mail.list.add',
    MAIL_LIST_REMOVE: 'mail.list.remove',
    MAIL_LIST_UPDATE: 'mail.list.update',

    REGISTRY_ADD: 'registry.add',
    REGISTRY_UPDATE: 'registry.update',
    REGISTRY_DEL: 'registry.del',

    SERVICE_CONFIGURE: 'service.configure',
    SERVICE_REBUILD: 'service.rebuild',
    SERVICE_RESTART: 'service.restart',

    USER_ADD: 'user.add',
    USER_LOGIN: 'user.login',
    USER_LOGIN_GHOST: 'user.login.ghost',
    USER_LOGOUT: 'user.logout',
    USER_REMOVE: 'user.remove',
    USER_UPDATE: 'user.update',
    USER_TRANSFER: 'user.transfer',

    USER_DIRECTORY_PROFILE_CONFIG_UPDATE: 'userdirectory.profileconfig.update',

    VOLUME_ADD: 'volume.add',
    VOLUME_UPDATE: 'volume.update',
    VOLUME_REMOUNT: 'volume.remount',
    VOLUME_REMOVE: 'volume.remove',

    DYNDNS_UPDATE: 'dyndns.update',

    SUPPORT_TICKET: 'support.ticket',
    SUPPORT_SSH: 'support.ssh',

    PROCESS_CRASH: 'system.crash',
});

// named exports
export {
    API_ORIGIN,
    BASE_URL,
    ACL_OPTIONS,
    APP_TYPES,
    ERROR,
    HSTATES,
    ISTATES,
    RSTATES,
    ROLES,
    TASK_TYPES,
    PROXY_APP_ID,
    TOKEN_TYPES,
    ENDPOINTS_OVH,
    STORAGE_PROVIDERS,
    BACKUP_FORMATS,
    REGIONS_CONTABO,
    REGIONS_VULTR,
    REGIONS_UPCLOUD,
    REGIONS_IONOS,
    REGIONS_OVH,
    REGIONS_LINODE,
    REGIONS_SCALEWAY,
    REGIONS_EXOSCALE,
    REGIONS_DIGITALOCEAN,
    REGIONS_HETZNER,
    REGIONS_WASABI,
    REGIONS_S3,
    EVENTS,
    RELAY_PROVIDERS,
};

// default export
export default {
    API_ORIGIN,
    BASE_URL,
    ACL_OPTIONS,
    APP_TYPES,
    ERROR,
    HSTATES,
    ISTATES,
    RSTATES,
    ROLES,
    TASK_TYPES,
    PROXY_APP_ID,
    TOKEN_TYPES,
    ENDPOINTS_OVH,
    STORAGE_PROVIDERS,
    BACKUP_FORMATS,
    REGIONS_CONTABO,
    REGIONS_VULTR,
    REGIONS_UPCLOUD,
    REGIONS_IONOS,
    REGIONS_OVH,
    REGIONS_LINODE,
    REGIONS_SCALEWAY,
    REGIONS_EXOSCALE,
    REGIONS_DIGITALOCEAN,
    REGIONS_HETZNER,
    REGIONS_WASABI,
    REGIONS_S3,
    EVENTS,
    RELAY_PROVIDERS,
};
