from .. import __package__ as base_package
import bpy
from bpy.types import AddonPreferences
from bpy.props import BoolProperty

class SW_Preferences(AddonPreferences):
    bl_idname = base_package
    
    only_with_multiple_scenes: BoolProperty(name="Show only with multiple scenes", description="Show the topbar (and eventually the checkbox) only when the project has multiple scenes", default=False)
    auto_init: BoolProperty(name="Auto initialize Scene Workspaces", description="Automatically add all avaliable workspaces to the current scene, if empty (with ordering only for common cases)", default=True)
    use_topbar: BoolProperty(name="Use Scene Workspaces topbar", description="Switch the workspace topbar between Scene Workspaces and the default one", default=True)
    switch: BoolProperty(name="Show Checkbox", description="Show/Hide the checkbox button next to the workspaces topbar. Useful for quickly lookup the original workspaces topbar", default=True)
    compact: BoolProperty(name="Use Compact Mode", description="If disabled, adds spacing around the active workspace and a quick unlink button", default=True)
    
    def draw(self, context):
        layout = self.layout
        layout.prop(self, "only_with_multiple_scenes")
        layout.prop(self, "auto_init")
        if self.auto_init:
            layout.label(text="Note: Scene Workspaces cannot retrive the global workspaces order.")
            layout.label(text="Only workspaces from one of the 5 default templates will be automatically ordered.")

        box = layout.box()
        box.label(text="UI Options")
        box.prop(self, "use_topbar")
        box.prop(self, "switch")
        box.prop(self, "compact")
