# pylint: disable=missing-docstring
"""This module has configurations for flask app."""

import os
import logging

SECRET_KEY = '751da714-b0b1-4152-8406-43b6414b'

basedir = os.path.abspath(os.path.dirname(__file__))


class BaseConfig(object):
    """Base class for default set of configs."""
    APPNAME = "Kikundi Rest App"
    VERSION = "0.1.261"
    BASEDIR = os.path.abspath(os.path.dirname(__file__))
    DEBUG = False
    TESTING = False
    LOGGING_FORMAT =  "[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s"
    LOGGING_LOCATION = 'log/kikundi-backend.log'
    LOGGING_LEVEL = logging.DEBUG
    SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
    SECURITY_TRACKABLE = True
    SECURITY_TOKEN_MAX_AGE = 60 * 30
    SECURITY_CONFIRMABLE = False
    SECURITY_PASSWORD_SALT = 'super-secret-stuff-here'
    SECURITY_PASSWORD_HASH = 'sha512_crypt'
    COMPRESS_MIME_TYPES = ['text/html', 'text/css', 'text/xml',
                           'application/json', 'application/javascript']
    MONGODB_URI = 'mongodb://localhost:27017/'
    MONGODB_DB_NAME = 'kikundi-db'


class DevelopmentConfig(BaseConfig):
    """Default set of configurations for development mode."""

    DEBUG = True
    TESTING = True
    MONGODB_DB_NAME = 'kikundi-db-dev'


class ProductionConfig(BaseConfig):
    """Default set of configurations for prod mode."""

    LOGGING_LEVEL = logging.ERROR
    MONGODB_DB_NAME = 'kikundi-db-prod'


class TestingConfig(BaseConfig):
    """Default set of configurations for test mode."""

    TESTING = True
    MONGODB_DB_NAME = 'kikundi-db-test'


config_by_name = dict(
    dev=DevelopmentConfig,
    test=TestingConfig,
    prod=ProductionConfig
)
