"""
Django settings for crypto_platform project.

Generated by 'django-admin startproject' using Django 6.0.3.

For more information on this file, see
https://docs.djangoproject.com/en/6.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/6.0/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-+ug716b&#rghq=c85-e63=@$!a_$8az(e6q2nt-4sr3r#kq1zj'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'jazzmin',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    
    # Local apps
    'accounts',
    'signals',
    'referrals',
    'wallet',
    'deposits',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'crypto_platform.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'builtins': [
                'accounts.templatetags.admin_verification_tags',
            ],
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'crypto_platform.wsgi.application'


# Database
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/6.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/6.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [
    BASE_DIR / 'static',
]

# Media files (Uploads)
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'

# Default primary key field type
# https://docs.djangoproject.com/en/6.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# Custom User Model
AUTH_USER_MODEL = 'accounts.User'

# Login URLs
LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = 'dashboard'
LOGOUT_REDIRECT_URL = 'home'

# Email settings (console backend for development)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'noreply@cryptoplatform.com'

# Jazzmin Settings
JAZZMIN_SETTINGS = {
    "site_title": "CryptoSignalsPro Admin",
    "site_header": "CryptoSignalsPro Control",
    "site_brand": "CryptoSignalsPro Admin",
    "welcome_sign": "Welcome to CryptoSignalsPro admin",
    "copyright": "CryptoSignalsPro",
    "custom_css": "admin/css/crypto-admin.css",
    "show_model_tools": True,
    "navigation_expanded": True,
    "search_model": ["accounts.User", "deposits.Deposit", "wallet.Transaction"],
    "order_with_respect_to": ["accounts", "signals", "referrals", "wallet", "deposits"],
    "topbar_links": [
        {"name": "View Site", "url": "home", "new_window": True},
        {"name": "Dashboard", "url": "dashboard", "new_window": True},
    ],
    "icons": {
        "accounts": "fas fa-user-shield",
        "accounts.user": "fas fa-user",
        "auth": "fas fa-users-cog",
        "auth.group": "fas fa-users",
        "deposits": "fas fa-wallet",
        "deposits.deposit": "fas fa-money-check-alt",
        "deposits.paymentinfo": "fas fa-qrcode",
        "wallet": "fas fa-coins",
        "wallet.wallet": "fas fa-wallet",
        "wallet.transaction": "fas fa-receipt",
        "signals": "fas fa-chart-line",
        "signals.coin": "fab fa-bitcoin",
        "signals.tradingsignal": "fas fa-bolt",
        "referrals": "fas fa-handshake",
        "referrals.referralcommission": "fas fa-percent",
        "referrals.referralearning": "fas fa-gift",
    },
}

JAZZMIN_UI_TWEAKS = {
    "theme": "cyborg",
    "default_theme_mode": "dark",
    "accent": "accent-info",
    "navbar": "navbar-dark",
    "no_navbar_border": True,
    "navbar_fixed": True,
    "sidebar": "sidebar-dark-primary",
    "sidebar_fixed": True,
    "sidebar_disable_expand": True,
    "sidebar_nav_compact_style": True,
    "brand_colour": "navbar-dark",
}
