from django.utils.translation import gettext_lazy as _

MIN_ICON_WIDTH = 192
MIN_SPLASH_WIDTH = 512
OFFLINE_FALLBACK_ROUTE = "/offline/"
MANIFEST_ROUTE = "/manifest.json"
SERVICE_WORKER_ROUTE = "/serviceworker.js"
DEFAULT_APP_NAME = "Website App"
DEFAULT_SHORT_NAME = "Website"
DEFAULT_DESCRIPTION = ""
DEFAULT_THEME_COLOR = "#0d6efd"
DEFAULT_BACKGROUND_COLOR = "#ffffff"
DEFAULT_FOREGROUND_COLOR = "#ffffff"
DEFAULT_ACCENT_COLOR = "#0d6efd"
DEFAULT_STATUS_BAR_COLOR = "#0d6efd"
DEFAULT_NAVIGATION_BAR_COLOR = "#ffffff"
DEFAULT_START_URL = "/"
DEFAULT_SCOPE = "/"
DEFAULT_DISPLAY_MODE = "standalone"
DEFAULT_ORIENTATION = "any"
DEFAULT_GENERATED_DIR = "mobile_apps"
DEFAULT_CACHE_VERSION = "v1"
DEFAULT_SPLASH_SIZE = 2732

DISPLAY_MODE_CHOICES = [
    ("standalone", _("Standalone")),
    ("fullscreen", _("Fullscreen")),
    ("minimal-ui", _("Minimal UI")),
    ("browser", _("Browser")),
]

ORIENTATION_CHOICES = [
    ("any", _("Any")),
    ("portrait", _("Portrait")),
    ("landscape", _("Landscape")),
    ("portrait-primary", _("Portrait primary")),
    ("portrait-secondary", _("Portrait secondary")),
    ("landscape-primary", _("Landscape primary")),
    ("landscape-secondary", _("Landscape secondary")),
]

MANIFEST_ICON_SPECS = [
    {"size": "32x32", "purpose": "any"},
    {"size": "180x180", "purpose": "any"},
    {"size": "192x192", "purpose": "any"},
    {"size": "192x192", "purpose": "maskable"},
    {"size": "512x512", "purpose": "any"},
    {"size": "512x512", "purpose": "maskable"},
]

APPLE_TOUCH_ICON_SIZE = "180x180"
ANDROID_ICON_SIZE = "192x192"
ANDROID_LARGE_ICON_SIZE = "512x512"

GENERATED_BRANDING_ASSETS = [
    "app-icon.png",
    "adaptive-icon.png",
    "adaptive-icon-foreground.png",
    "adaptive-icon-background.png",
    "splash.png",
    "favicon-32.png",
    "favicon-180.png",
    "icon-48.png",
    "icon-72.png",
    "icon-96.png",
    "icon-144.png",
    "icon-192.png",
    "icon-512.png",
    "branding.json",
]

ANDROID_ICON_SIZES = [48, 72, 96, 144, 192, 512]
PWA_ICON_SIZES = [192, 512]
APPLE_ICON_SIZE = 180
FAVICON_SIZE = 32
ADAPTIVE_ICON_SIZE = 512

SERVICE_WORKER_EXCLUDED_PREFIXES = [
    "/admin/",
    "/django-admin/",
    "/api/",
    "/documents/",
]

THIN_WRAPPER_WARNING = _(
    "Native app packages generated from a website alone may be rejected by app stores if they do not add clear app-specific value."
)

CAPABILITY_DASHBOARD_NOTES = [
    _(
        "App Store review risk is lower when the app provides real native value beyond a thin website wrapper."
    ),
    _(
        "Push, camera, location, QR, and biometrics require extra permission text and platform configuration."
    ),
    _(
        "Do not request native permissions unless the app actually uses the corresponding capability."
    ),
]

ANDROID_PERMISSION_PLACEHOLDERS = [
    {
        "key": "camera",
        "title": _("Camera"),
        "placeholder": _(
            "Explain why the app needs camera access and which upload or scanning workflow depends on it."
        ),
    },
    {
        "key": "location",
        "title": _("Location"),
        "placeholder": _(
            "Explain why the app needs location access and whether access is foreground-only."
        ),
    },
    {
        "key": "notifications",
        "title": _("Notifications"),
        "placeholder": _(
            "Document which notification types the app sends and why they matter to the user."
        ),
    },
]

IOS_PERMISSION_PLACEHOLDERS = [
    {
        "key": "camera_usage_description",
        "title": _("Camera usage description"),
        "placeholder": _(
            "Add NSCameraUsageDescription text that explains the upload or scanning flow in plain language."
        ),
    },
    {
        "key": "location_usage_description",
        "title": _("Location usage description"),
        "placeholder": _(
            "Add NSLocationWhenInUseUsageDescription text that explains the location-dependent feature."
        ),
    },
    {
        "key": "face_id_usage_description",
        "title": _("Face ID usage description"),
        "placeholder": _(
            "Add NSFaceIDUsageDescription text only if the app uses biometric authentication."
        ),
    },
    {
        "key": "notifications_setup",
        "title": _("Notification setup notes"),
        "placeholder": _(
            "Document APNs setup, notification purpose, and any foreground/background handling expectations."
        ),
    },
]

CAMERA_CAPACITOR_PACKAGE = "@capacitor/camera"
FILE_PICKER_CAPACITOR_PACKAGE = "@capawesome/capacitor-file-picker"

BRANDING_DASHBOARD_NOTES = [
    _(
        "Use one high-resolution square icon with transparent padding where possible. The generator will derive the platform icon sizes automatically."
    ),
    _(
        "Splash screens work best with a centered logo, a solid background color, and an optional high-resolution splash image."
    ),
    _(
        "Adaptive icons improve Android presentation. Foreground and background assets are generated automatically from the uploaded branding settings."
    ),
]
