from dotenv import load_dotenv
# from http.cookiejar import debug
from pathlib import Path
from datetime import timedelta
import os
from django.templatetags.static import static
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _

load_dotenv(".env.local")


UNFOLD = {
    "SITE_TITLE": os.getenv("SITE_TITLE"),
    "SITE_HEADER": os.getenv("SITE_HEADER"),
    "SITE_URL": os.getenv("DOMAIN"),
    "THEME": 'dark',
    "SITE_SYMBOL": "settings",
    "DASHBOARD_CALLBACK": "core.views.dashboard_callback",
    "SITE_FAVICONS": [
        {
            "rel": "icon",
            "sizes": "32x32",
            "type": "image/svg+xml",
            "href": lambda request: static("favicon.svg"),
        },
    ],
    "LOGIN": {
        "image": lambda request: static("favicon.png"),
    },
    "STYLES": [
            lambda request: static("rtl.css"),
            lambda request: static("rtl2.css"),
            lambda request: static("fonts.css"),
            lambda request: static("override.css"),

        ],
    # "SCRIPTS": [
    #     lambda request: static("price-format.js"),
    # ],

    "BORDER_RADIUS": "8px",
    "SHOW_HISTORY": True,
    "SHOW_VIEW_ON_SITE": True,
    "ENVIRONMENT": "core.settings.environment_callback",

"COLORS": {
    "base": {
        "50": "250 250 250",
        "100": "245 245 245",
        "200": "229 229 229",
        "300": "212 212 212",
        "400": "163 163 163",
        "500": "115 115 115",
        "600": "82 82 82",
        "700": "64 64 64",
        "800": "42 42 42",
        "900": "23 23 23",
        "950": "10 10 10"
    },
    "primary": {
        "50": "240 253 244",
        "100": "220 252 231",
        "200": "187 247 208",
        "300": "134 239 172",
        "400": "74 222 128",
        "500": "34 197 94",
        "600": "22 163 74",
        "700": "21 128 61",
        "800": "22 101 52",
        "900": "20 83 45",
        "950": "5 46 22"
    },
        "font": {
            "subtle-light": "var(--color-base-500)",  # text-base-500
            "subtle-dark": "var(--color-base-400)",  # text-base-400
            "default-light": "var(--color-base-600)",  # text-base-600
            "default-dark": "var(--color-base-300)",  # text-base-300
            "important-light": "var(--color-base-900)",  # text-base-900
            "important-dark": "var(--color-base-100)",  # text-base-100
        },
    },
    "EXTENSIONS": {
        "modeltranslation": {
            "flags": {
                "en": "🇬🇧",
            },
        },
    },

   "SIDEBAR": {
        "show_search": False,
        "show_all_applications": False,
        "navigation": [
            {

                "separator": False,  # Top border
                "collapsible": False,  # Collapsible group of links
                "items": [
                    {
                        "title": _("داشبرد ادمین"),
                        "icon": "dashboard",  
                        "link": reverse_lazy("admin:index"),
                    },
                    # {
                    #     "title": _("آموزش استفاده از پنل"),
                    #     "icon": "school",  
                    #     "link": reverse_lazy("admin:home_learnvideomodel_changelist"),
                    #     "badge": "utils.admin.new_learn_video_count",
                    # },
                    {
                        "title": _("فروشگاه ها"),
                        "icon": "storefront",
                        "link": reverse_lazy("admin:account_shopmodel_changelist"),
                        # "permission": lambda request: request.user.is_superuser,
                    },
                ],
            },



                          {
                "title": _("محصولات سفارشات"),
                "separator": True,  
                "collapsible": False,  
                "items": [
                    {
                        "title": _("سفارشات"),
                        "icon": "shopping_cart",  
                        "link": reverse_lazy("admin:order_ordermodel_changelist"),
                        # "badge": "utils.admin.admin_pending_count",
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("سفارشات فروشگاه"),
                        "icon": "shopping_cart",  
                        "link": reverse_lazy("admin:order_shopordermodel_changelist"),
                        # "badge": "utils.admin.admin_pending_count",
                    },
                    {
                        "title": _("گزارش فروش فروشگاه ها"),
                        "icon": "shopping_cart",  
                        "link": reverse_lazy("admin:order_shopdailyreport_changelist"),
                        # "badge": "utils.admin.admin_pending_count",
                    },

                ],
            },


                          {
                "title": _("محصولات فروشگاه"),
                "separator": True,  
                "collapsible": False,  
                "items": [
                    {
                        "title": _("محصولات"),
                        "icon": "redeem",  
                        "link": reverse_lazy("admin:product_productmodel_changelist"),
                    },

                    {
                        "title": _("قیمت دلار"),
                        "icon": "payments",  
                        "link": reverse_lazy("admin:product_dollormodel_changelist"),
                        "badge": "utils.admin.dollor_price",
                    },
                    {
                        "title": _("کد تخفیف"),
                        "icon": "payments",  
                        "link": reverse_lazy("admin:order_discountcode_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },

                ],
            },


                          {
                "title": _("سکشن دسته بندی"),
                "separator": True,  
                "collapsible": True,  
                "items": [

                    {
                        "title": _("دسته بندی واحد"),
                        "icon": "category",  
                        "link": reverse_lazy("admin:product_unitcategorymodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("دسته بندی"),
                        "icon": "category",  
                        "link": reverse_lazy("admin:product_maincategorymodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("زیر دسته بندی"),
                        "icon": "category",  
                        "link": reverse_lazy("admin:product_subcategorymodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("دسته بندی پورسانتی"),
                        "icon": "devices",  
                        "link": reverse_lazy("admin:home_showcaseslider_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                ],
            },
                            {
                "title": _("سکشن های نمایشی"),
                "separator": True,  
                "collapsible": True,  
                "items": [

                    {
                        "title": _("اسلاید ها"),
                        "icon": "slide_library",  
                        "link": reverse_lazy("admin:home_slidermodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("عکس مقایسه"),
                        "icon": "compare",  
                        "link": reverse_lazy("admin:home_homeimagemodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    }
                    ,
                    {
                        "title": _("مقالات و بلاگ ها"),
                        "icon": "newsmode",  
                        "link": reverse_lazy("admin:blog_blogmodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("دسته بندی بلاگ"),
                        "icon": "newsmode",  
                        "link": reverse_lazy("admin:blog_blogcategorymodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },


                ],
            },

                          {
                "title": _("کاربران و مشتریان"),
                "separator": True,  
                "collapsible": True,  
                "items": [

                    {
                        "title": _("کاربران"),
                        "icon": "person",  
                        "link": reverse_lazy("admin:account_user_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": "گروه‌های دسترسی",
                        "icon": "group",
                        "link": reverse_lazy("admin:auth_group_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },  
                    
                    {
                        "title": _("چت محصول"),
                        "icon": "chat",  
                        "link": reverse_lazy("admin:chat_productchatmodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                 {
                        "title": _("ادرس ها"),
                        "icon": "contact_mail",  
                        "link": reverse_lazy("admin:account_useraddressmodel_changelist"),
                    },
                 {
                        "title": _("تلاش‌های نفوذ"),
                        "icon": "gpp_maybe",  
                        "link": reverse_lazy("admin:account_securitybreachattemptmodel_changelist"),
                        "badge": 'utils.admin.new_attck_count',
                        "permission": lambda request: request.user.is_superuser,
                    },
                 {
                        "title": _("اخبار"),
                        "icon": "newspaper",  
                        "link": reverse_lazy("admin:account_newsmodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,

                    },
                 {
                        "title": _("اطلاعیه ها"),
                        "icon": "notifications",  
                        "link": reverse_lazy("admin:account_usernotificationmodel_changelist"),
                        "permission": lambda request: request.user.is_superuser,

                    },

                ],
            },

                {
                "title": _("پشتیبانی و تیکت"),
                "separator": True,  
                "collapsible": True,  
                "items": [

                    {
                        "title": _("تیکت"),
                        "icon": "confirmation_number",  
                        "link": reverse_lazy("admin:ticket_ticket_changelist"),
                        "badge": "utils.admin.new_ticket_count",
                        "permission": lambda request: request.user.is_superuser,
                    },

                    {
                        "title": _("ارتباط با ما"),
                        "icon": "perm_phone_msg",  
                        "link": reverse_lazy("admin:ticket_contactusmodel_changelist"),
                        "badge": "utils.admin.new_contact_us_count",
                        "permission": lambda request: request.user.is_superuser,
                    },
                ],
            },
                {
                "title": _("بخش تنوع محصول"),
                "separator": True,  
                "collapsible": True,  
                "items": [

                    {
                        "title": _("نوع صفت"),
                        "icon": "format_list_bulleted_add",  
                        "link": reverse_lazy("admin:product_attributetype_changelist"),
                    },
                    {
                        "title": _("مقدار صفت"),
                        "icon": "variable_add",  
                        "link": reverse_lazy("admin:product_attributevalue_changelist"),
                    },
                    {
                        "title": _("تنوع محصول"),
                        "icon": "photo_prints",  
                        "link": reverse_lazy("admin:product_productvariant_changelist"),
                    },
                    {
                        "title": _("بخش جزيیات محصول"),
                        "icon": "subject",  
                        "link": reverse_lazy("admin:product_productdetailmodel_changelist"),
                    },

                ],
            },
# {
#                 "title": _("تسک های سلری"),
#                 "collapsible": True,
#                 "items": [
#                     {
#                         "title": _("Clocked"),
#                         "icon": "hourglass_bottom",
#                         "link": reverse_lazy(
#                             "admin:django_celery_beat_clockedschedule_changelist"
#                         ),
#                     },
#                     {
#                         "title": _("Crontabs"),
#                         "icon": "update",
#                         "link": reverse_lazy(
#                             "admin:django_celery_beat_crontabschedule_changelist"
#                         ),
#                     },
#                     {
#                         "title": _("Intervals"),
#                         "icon": "arrow_range",
#                         "link": reverse_lazy(
#                             "admin:django_celery_beat_intervalschedule_changelist"
#                         ),
#                     },
#                     {
#                         "title": _("Periodic tasks"),
#                         "icon": "task",
#                         "link": reverse_lazy(
#                             "admin:django_celery_beat_periodictask_changelist"
#                         ),
#                     },
#                     {
#                         "title": _("Solar events"),
#                         "icon": "event",
#                         "link": reverse_lazy(
#                             "admin:django_celery_beat_solarschedule_changelist"
#                         ),
#                     },
#                 ],
#             },
        
        ],
    },
}

def environment_callback(request):
    return ["نسخه ی توسعه", "success"]