# -*- coding: utf-8 -*-

# -----------------------------------------------------------------------------
# Copyright (c) 2016-2017 Anaconda, Inc.
#
# May be copied and distributed freely only as part of an Anaconda or
# Miniconda installation.
# -----------------------------------------------------------------------------

"""Default configuration options."""

import os
import sys
from anaconda_navigator.config.base import SUBFOLDER
from anaconda_navigator.config.user import UserConfig


# -----------------------------------------------------------------------------
# --- Defaults
# -----------------------------------------------------------------------------

DEFAULTS = [
    (
        'main',  # General
        {
            'name': 'Anaconda Navigator',
            'first_run': True,
            'hide_quit_dialog': False,
            'hide_running_apps_dialog': False,
            'hide_update_dialog': False,
            'hide_offline_dialog': True,
            'first_time_offline': True,
            'last_status_is_offline': False,
            'running_apps_to_close': ['anaconda-fusion'],  # Hidden opt
            'add_default_channels': True,
            'offline_mode': False,
            'default_env': os.environ.get('CONDA_PREFIX'),

            # --- Package Manager
            'conda_active_channels': None,

            # --- Anaconda Client Configuration, these values are not needed
            'logged_brand': None,
            'logged_api_url': None,
            'nucleus_base_url': 'https://anaconda.cloud',
            'anaconda_api_url': 'https://api.anaconda.org',
            'team_edition_api_url': None,
            'team_edition_token': None,
            'team_edition_token_id': None,
            'enterprise_4_repo_api_url': None,
            'commercial_edition_url': 'https://repo.anaconda.cloud',
            'ssl_verification': True,
            'ssl_certificate': None,
            # Used by batch initial config
            'default_anaconda_api_url': None,
            'default_ssl_certificate': None,

            # --- Preferences
            'enable_high_dpi_scaling': not sys.platform.startswith('linux'),
            'provide_analytics': True,
            'show_application_environments': True,
            'show_application_launch_errors': True,

            # --- Custom links
            'twitter_url': 'https://twitter.com/AnacondaInc',
            'youtube_url': 'https://www.youtube.com/c/continuumio',
            'github_url': 'https://github.com/ContinuumIO',

            # --- Advertisements url
            'advertisement_url': 'https://www.anaconda.com/api/navigator',

        },
    ),
    (
        'home',
        {
            # enable here means always show the tile.
            # We don't always show them, because we don't want to deal with
            # installers.  We still show the tile if
            # the software is detected locally.
            'vscode_enable': False,
            'pycharm_enable': False,
        }
    ),
    # --- External apps paths
    (
        'applications',
        {
            'vscode_path': '',
            'pycharm_ce_path': '',
            'pycharm_pro_path': '',
        }
    )
]

# -----------------------------------------------------------------------------
# --- Config instance
# -----------------------------------------------------------------------------
# IMPORTANT NOTES:
# 1. If you want to *change* the default value of a current option, you need to
#    do a MINOR update in config version, e.g. from 1.0.0 to 1.1.0
# 2. If you want to *remove* options that are no longer needed in our codebase,
#    or if you want to *rename* options, then you need to do a MAJOR update in
#    version, e.g. from 1.0.0 to 2.0.0
# 3. You don't need to touch this value if you're just adding a new option
CONF_VERSION = '2.0.0'
CONF = UserConfig(
    'anaconda-navigator',
    defaults=DEFAULTS,
    version=CONF_VERSION,
    subfolder=SUBFOLDER,
    raw_mode=True,
)
