"""
Django settings for ohhom project.

Generated by 'django-admin startproject' using Django 4.1.6.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

from pathlib import Path
import os
# 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/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-z6rcx8&ydfds$bt8_1$hlwrce$(gx#z-81j@f-5kg4hl*!1ai+"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['*']

CSRF_TRUSTED_ORIGINS = ['http://127.0.0.1:8000', 'http://localhost:8000', "https://tuespacioelite.com", "https://www.tuespacioelite.com"]

X_FRAME_OPTIONS = 'SAMEORIGIN'  

# Application definition

INSTALLED_APPS = [
    "jazzmin",
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "category",
    "agency",
    "location",
]

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 = "ohhom.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [os.path.join(BASE_DIR, 'templates')],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "category.context_processors.menu_links",
                "location.context_processors.Locations_links",
            ],
        },
    },
]


WSGI_APPLICATION = "ohhom.wsgi.application"

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'tuespacioelite',       
        'USER': 'uremoto',
        'PASSWORD': 'M@j0309!mysql**remoto',
        'HOST': '45.79.2.216',
        'PORT': '3306',
        'OPTIONS': {
            'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
            'charset': 'utf8mb4',
        },
    }
}
"""
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    }
}
"""


# Password validation
# https://docs.djangoproject.com/en/4.1/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/4.1/topics/i18n/

LANGUAGE_CODE = 'es-co'

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True


# Configuración de archivos estáticos
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]

# Configuración de archivos media (si los usas)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# Configura la URL para archivos estáticos del admin
ADMIN_MEDIA_PREFIX = os.path.join(STATIC_ROOT, 'admin')

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

JAZZMIN_SETTINGS = {
    "site_title": "Tu Espacio Elite - Admin",
    "site_header": "Tu Espacio Elite",
    "site_brand": "Tu Espacio Elite",
    "login_logo_dark": None,
    "login_logo": "images/logo.png",
    "site_logo": "images/logotipo.png",
    "site_logo_classes": "img-fluid",
    "welcome_sign": "Bienvenido a Tu Espacio Elite",
    "copyright": "Tu Espacio Elite",
    "search_model": ["agency.Property"],
    
    # Iconos de las apps
    "icons": {
        "auth": "fas fa-users-cog",
        "auth.user": "fas fa-user",
        "auth.group": "fas fa-users",
        "category.category": "fas fa-tags",
        "agency.property": "fas fa-building",
        "agency.propertygallery": "fas fa-image",
        "location.location": "fas fa-map-marker-alt",
    },
    
    # Orden de las apps en el menú
    "order_with_respect_to": ["account", "agency", "category", "location"],
    
    # Enlaces del menú superior - AQUÍ AGREGAMOS EL DASHBOARD
    "topmenu_links": [
        {"name": "📊 Dashboard", "url": "/admin/dashboard/", "permissions": ["auth.view_user"]},
        {"name": "Sitio Web", "url": "/", "permissions": ["auth.view_user"]},
    ],
    
    "show_sidebar": True,
    "navigation_expanded": True,
    
    # Personalización visual
    "theme": "lux",
    "custom_css": None,
    "custom_js": None,
    "related_modal_active": True,
    "use_google_fonts_cdn": True,
    "show_ui_builder": False,
    
}