import click


def prompt_for_update(config, key):
    """Prompt user for config var.

    Asks the user to provide a config value.

    If a value already existed in the .env file, it is
    shown as the default.
    """
    prompts = {
        'TWILIO_ACCOUNT_SID': 'Twilio account SID',
        'TWILIO_AUTH_TOKEN': 'Twilio auth token',
        'TWILIO_FROM_NUM': 'The phone number you want to use (you need to buy one on Twilio)',
        'TWILIO_SENDING_COST':
        'Cost of sending messages in your country (see: https://www.twilio.com/sms/pricing)',
        'DJANGO_EMAIL_HOST': 'Email host',
        'DJANGO_EMAIL_HOST_USER': 'Email user',
        'DJANGO_EMAIL_HOST_PASSWORD': 'Email password',
        'DJANGO_FROM_EMAIL':
        'From email (the address that apostello emails will appear to come from)',
        'DJANGO_TIME_ZONE':
        'Please enter your time zone, a list of which can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones',
        'CADDY_LE_EMAIL':
        'We use caddy as a web server\nThis allows automatic SSL, but you need to provide an email address for the Lets Encrypt process',
        'ELVANTO_KEY': 'Elvanto API Key',
        'COUNTRY_CODE': 'Country Phone number prefix, eg 44',
        'WHITELISTED_LOGIN_DOMAINS':
        'Comma separated list of domains (e.g. apostello.ninja,apostello.io)',
        'OPBEAT_APP_ID': 'Opbeat App ID:',
        'OPBEAT_ORGANIZATION_ID': 'Opbeat Org ID:',
        'OPBEAT_SECRET_TOKEN': 'Opbeat scret token',
        'OPBEAT_JS_APP_ID': 'Opbeat app ID',
        'OPBEAT_JS_ORG_ID': 'Opbeat org ID',
    }

    if key in config:
        config[key] = click.prompt(prompts[key], default=config[key])
    else:
        config[key] = click.prompt(prompts[key], )

    return config