from pathlib import Path

from configtype.jsonconfig import setup_search_paths

BASE_DIR = Path(__file__).resolve().parents[2]
setup_search_paths(str(BASE_DIR / "oxyan" / "themes" / "testdata"))

SECRET_KEY = "oxyan-themes-test-key"
DEBUG = True
USE_TZ = True
ROOT_URLCONF = "oxyan.themes.test_urls"
ALLOWED_HOSTS = ["*"]
STATIC_URL = "/static/"
MEDIA_URL = "/media/"
MEDIA_ROOT = str(BASE_DIR / ".test-media")

INSTALLED_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
]

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",
]

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [str(BASE_DIR / "oxyan" / "themes" / "templates")],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.request",
                "django.template.context_processors.static",
            ],
            "libraries": {
                "oxyan": "oxyan.themes.templatetags.oxyan",
            },
        },
    }
]

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": ":memory:",
    }
}

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
OXYAN_THEME = "default"
OXYAN_THEME_MIXINS = []
