# Released under the MIT License. See LICENSE for details.
#
# AUTO-GENERATED by `tools/pcommand gen_ui_asset_set_py`.
# DO NOT EDIT BY HAND.
#
# Generated from src/codegen/bauiv1codegen/ui_assets.py.
"""Supplying ui_v1 with the assets it draws itself with."""

from typing import TYPE_CHECKING

import _bauiv1

from bauiv1 import _uiv1assets

if TYPE_CHECKING:
    import bauiv1


class UIAssetSet:
    """The assets the ui_v1 widget layer draws itself with.

    An app-mode that uses ui_v1 builds one of these (normally as
    part of the config returned by its
    :meth:`~babase.AppMode.new_app_mode_config`) and hands it to
    :func:`bauiv1.set_ui_asset_set` when activating; this is what
    lets an app-mode skin the ui. Supplying the art this way,
    rather than ui_v1 reaching for it itself, is what keeps ui_v1
    ignorant of which asset-packages the art lives in.

    Slots hold asset *handles* (e.g.
    :class:`~bauiv1.TextureHandle`), not loaded assets; nothing
    loads until the set is applied at activation, so art that a
    mode subclass or plugin replaces is never loaded at all.

    Slots ui_v1 has no art of its own for are constructor
    arguments, so a set is complete by construction. The rest
    start out at ui_v1's own art. All slots are plain mutable
    attributes, so an app-mode subclass or plugin amending a
    config can restyle any of them before the set is applied.
    """

    # One attr per slot is the whole point of this class; the
    # complexity limits are aimed at hand-written code where
    # this shape signals trouble.
    # pylint: disable=too-many-instance-attributes

    # -- Window furniture -- the backings, buttons, scrollbars and widget
    # art the ui draws itself out of.
    #: Back-arrow glyph on nav buttons.
    back_icon: bauiv1.TextureHandle
    #: Bomb glyph used on touch controls shown in ui.
    bomb_button: bauiv1.TextureHandle
    #: Square button face.
    button_square: bauiv1.TextureHandle
    #: Wide square button face.
    button_square_wide: bauiv1.TextureHandle
    #: Plain filled circle.
    circle: bauiv1.TextureHandle
    #: Soft-edged filled circle.
    circle_soft: bauiv1.TextureHandle
    #: Additive glow sprite.
    glow: bauiv1.TextureHandle
    #: Menu glyph on the root ui bar.
    menu_button: bauiv1.TextureHandle
    #: Small nub marker.
    nub: bauiv1.TextureHandle
    #: Left/right page-flip arrows.
    page_left_right: bauiv1.TextureHandle
    #: Scroll-region background.
    scroll_widget: bauiv1.TextureHandle
    #: Scroll-region edge glow.
    scroll_widget_glow: bauiv1.TextureHandle
    #: Hard-edged drop shadow.
    shadow_sharp: bauiv1.TextureHandle
    #: Busy spinner.
    spinner: bauiv1.TextureHandle
    #: Spinner animation frame 0.
    spinner0: bauiv1.TextureHandle
    #: Spinner animation frame 1.
    spinner1: bauiv1.TextureHandle
    #: Spinner animation frame 10.
    spinner10: bauiv1.TextureHandle
    #: Spinner animation frame 11.
    spinner11: bauiv1.TextureHandle
    #: Spinner animation frame 2.
    spinner2: bauiv1.TextureHandle
    #: Spinner animation frame 3.
    spinner3: bauiv1.TextureHandle
    #: Spinner animation frame 4.
    spinner4: bauiv1.TextureHandle
    #: Spinner animation frame 5.
    spinner5: bauiv1.TextureHandle
    #: Spinner animation frame 6.
    spinner6: bauiv1.TextureHandle
    #: Spinner animation frame 7.
    spinner7: bauiv1.TextureHandle
    #: Spinner animation frame 8.
    spinner8: bauiv1.TextureHandle
    #: Spinner animation frame 9.
    spinner9: bauiv1.TextureHandle
    #: Start glyph used on touch controls shown in ui.
    start_button: bauiv1.TextureHandle
    #: Clear-text (x) glyph in text fields.
    text_clear_button: bauiv1.TextureHandle
    #: Primary ui sprite atlas.
    ui_atlas: bauiv1.TextureHandle
    #: Secondary ui sprite atlas.
    ui_atlas2: bauiv1.TextureHandle
    #: Squad/users glyph on the root ui bar.
    users_button: bauiv1.TextureHandle
    #: Flat white pixel.
    white: bauiv1.TextureHandle
    #: Window background for taller windows.
    window_hsmall_vmed: bauiv1.TextureHandle
    #: Window background for shorter windows.
    window_hsmall_vsmall: bauiv1.TextureHandle
    #: Button back backing (opaque pass).
    button_back_opaque: bauiv1.MeshHandle
    #: Button back small backing (opaque pass).
    button_back_small_opaque: bauiv1.MeshHandle
    #: Button back small backing (transparent pass).
    button_back_small_transparent: bauiv1.MeshHandle
    #: Button back backing (transparent pass).
    button_back_transparent: bauiv1.MeshHandle
    #: Button large backing (opaque pass).
    button_large_opaque: bauiv1.MeshHandle
    #: Button large backing (transparent pass).
    button_large_transparent: bauiv1.MeshHandle
    #: Button larger backing (opaque pass).
    button_larger_opaque: bauiv1.MeshHandle
    #: Button larger backing (transparent pass).
    button_larger_transparent: bauiv1.MeshHandle
    #: Button medium backing (opaque pass).
    button_medium_opaque: bauiv1.MeshHandle
    #: Button medium backing (transparent pass).
    button_medium_transparent: bauiv1.MeshHandle
    #: Button small backing (opaque pass).
    button_small_opaque: bauiv1.MeshHandle
    #: Button small backing (transparent pass).
    button_small_transparent: bauiv1.MeshHandle
    #: Button square backing (opaque pass).
    button_square_opaque: bauiv1.MeshHandle
    #: Button square backing (transparent pass).
    button_square_transparent: bauiv1.MeshHandle
    #: Button tab backing (opaque pass).
    button_tab_opaque: bauiv1.MeshHandle
    #: Button tab backing (transparent pass).
    button_tab_transparent: bauiv1.MeshHandle
    #: Checkbox tick.
    check_transparent: bauiv1.MeshHandle
    #: Unit quad for plain image draws.
    image1x1: bauiv1.MeshHandle
    #: Scrollbar thumb (opaque pass).
    scroll_bar_thumb_opaque: bauiv1.MeshHandle
    #: Short scrollbar thumb (opaque pass).
    scroll_bar_thumb_short_opaque: bauiv1.MeshHandle
    #: Short scrollbar thumb (transparent pass).
    scroll_bar_thumb_short_transparent: bauiv1.MeshHandle
    #: Scrollbar thumb (transparent pass).
    scroll_bar_thumb_transparent: bauiv1.MeshHandle
    #: Scrollbar trough.
    scroll_bar_trough_transparent: bauiv1.MeshHandle
    #: Soft outer edge trim.
    soft_edge_outside: bauiv1.MeshHandle
    #: Text-field background.
    text_box_transparent: bauiv1.MeshHandle
    #: Window backing mesh (opaque pass).
    window_hsmall_vmed_opaque: bauiv1.MeshHandle
    #: Window backing mesh (transparent pass).
    window_hsmall_vmed_transparent: bauiv1.MeshHandle
    #: Window backing mesh (opaque pass).
    window_hsmall_vsmall_opaque: bauiv1.MeshHandle
    #: Window backing mesh (transparent pass).
    window_hsmall_vsmall_transparent: bauiv1.MeshHandle
    #: Standard widget-interaction whoosh.
    swish: bauiv1.SoundHandle
    #: Button-press whoosh variant.
    swish2: bauiv1.SoundHandle
    #: Button-release / checkbox whoosh variant.
    swish3: bauiv1.SoundHandle
    #: Ticker for animated count-ups (currency, rank).
    score_increase: bauiv1.SoundHandle

    # -- Art for the persistent root toolbar -- the account, currency and
    # menu affordances that sit above every window.
    #: Level meter icon on the root ui bar.
    level_icon: bauiv1.TextureHandle
    #: League-rank trophy on the root ui bar.
    trophy: bauiv1.TextureHandle
    #: Empty chest slot on the root ui bar.
    chest_icon_empty: bauiv1.TextureHandle
    #: Inbox/log glyph on the root ui bar.
    log_icon: bauiv1.TextureHandle
    #: Leaderboards glyph on the root ui bar.
    leaderboards_icon: bauiv1.TextureHandle
    #: Inventory glyph on the root ui bar.
    inventory_icon: bauiv1.TextureHandle
    #: Store glyph on the root ui bar.
    store_icon: bauiv1.TextureHandle
    #: Seasonal store-button decoration.
    store_character_xmas: bauiv1.TextureHandle
    #: Coin (tickets currency) icon on the root ui bar.
    coin: bauiv1.TextureHandle
    #: Tickets meter icon on the root ui bar.
    tickets: bauiv1.TextureHandle
    #: Lock overlay on a locked chest slot.
    lock: bauiv1.TextureHandle
    #: Watch-ad overlay on a chest slot.
    tv: bauiv1.TextureHandle
    #: Achievements glyph on the root ui bar.
    achievements_icon: bauiv1.TextureHandle
    #: Settings glyph on the root ui bar.
    settings_icon: bauiv1.TextureHandle
    #: Backing for the currency meters.
    currency_meter: bauiv1.MeshHandle
    #: Backing for the currency plus button.
    currency_plus_button: bauiv1.MeshHandle
    #: Top toolbar backing.
    toolbar_backing_top2: bauiv1.MeshHandle
    #: Bottom toolbar backing.
    toolbar_backing_bottom2: bauiv1.MeshHandle

    def __init__(
        self,
        *,
        level_icon: bauiv1.TextureHandle,
        trophy: bauiv1.TextureHandle,
        chest_icon_empty: bauiv1.TextureHandle,
        log_icon: bauiv1.TextureHandle,
        leaderboards_icon: bauiv1.TextureHandle,
        inventory_icon: bauiv1.TextureHandle,
        store_icon: bauiv1.TextureHandle,
        store_character_xmas: bauiv1.TextureHandle,
        coin: bauiv1.TextureHandle,
        tickets: bauiv1.TextureHandle,
        lock: bauiv1.TextureHandle,
        tv: bauiv1.TextureHandle,
        achievements_icon: bauiv1.TextureHandle,
        settings_icon: bauiv1.TextureHandle,
        currency_meter: bauiv1.MeshHandle,
        currency_plus_button: bauiv1.MeshHandle,
        toolbar_backing_top2: bauiv1.MeshHandle,
        toolbar_backing_bottom2: bauiv1.MeshHandle,
    ) -> None:
        # pylint: disable=too-many-arguments
        # pylint: disable=too-many-statements
        self.level_icon = level_icon
        self.trophy = trophy
        self.chest_icon_empty = chest_icon_empty
        self.log_icon = log_icon
        self.leaderboards_icon = leaderboards_icon
        self.inventory_icon = inventory_icon
        self.store_icon = store_icon
        self.store_character_xmas = store_character_xmas
        self.coin = coin
        self.tickets = tickets
        self.lock = lock
        self.tv = tv
        self.achievements_icon = achievements_icon
        self.settings_icon = settings_icon
        self.currency_meter = currency_meter
        self.currency_plus_button = currency_plus_button
        self.toolbar_backing_top2 = toolbar_backing_top2
        self.toolbar_backing_bottom2 = toolbar_backing_bottom2

        # Slots ui_v1 has art of its own for start at it
        # (handles only; nothing is loaded here).
        self.back_icon = _uiv1assets.textures.back_icon
        self.bomb_button = _uiv1assets.textures.bomb_button
        self.button_square = _uiv1assets.textures.button_square
        self.button_square_wide = _uiv1assets.textures.button_square_wide
        self.circle = _uiv1assets.textures.circle
        self.circle_soft = _uiv1assets.textures.circle_soft
        self.glow = _uiv1assets.textures.glow
        self.menu_button = _uiv1assets.textures.menu_button
        self.nub = _uiv1assets.textures.nub
        self.page_left_right = _uiv1assets.textures.page_left_right
        self.scroll_widget = _uiv1assets.textures.scroll_widget
        self.scroll_widget_glow = _uiv1assets.textures.scroll_widget_glow
        self.shadow_sharp = _uiv1assets.textures.shadow_sharp
        self.spinner = _uiv1assets.textures.spinner
        self.spinner0 = _uiv1assets.textures.spinner0
        self.spinner1 = _uiv1assets.textures.spinner1
        self.spinner10 = _uiv1assets.textures.spinner10
        self.spinner11 = _uiv1assets.textures.spinner11
        self.spinner2 = _uiv1assets.textures.spinner2
        self.spinner3 = _uiv1assets.textures.spinner3
        self.spinner4 = _uiv1assets.textures.spinner4
        self.spinner5 = _uiv1assets.textures.spinner5
        self.spinner6 = _uiv1assets.textures.spinner6
        self.spinner7 = _uiv1assets.textures.spinner7
        self.spinner8 = _uiv1assets.textures.spinner8
        self.spinner9 = _uiv1assets.textures.spinner9
        self.start_button = _uiv1assets.textures.start_button
        self.text_clear_button = _uiv1assets.textures.text_clear_button
        self.ui_atlas = _uiv1assets.textures.ui_atlas
        self.ui_atlas2 = _uiv1assets.textures.ui_atlas2
        self.users_button = _uiv1assets.textures.users_button
        self.white = _uiv1assets.textures.white
        self.window_hsmall_vmed = _uiv1assets.textures.window_hsmall_vmed
        self.window_hsmall_vsmall = _uiv1assets.textures.window_hsmall_vsmall
        self.button_back_opaque = _uiv1assets.meshes.button_back_opaque
        self.button_back_small_opaque = (
            _uiv1assets.meshes.button_back_small_opaque
        )
        self.button_back_small_transparent = (
            _uiv1assets.meshes.button_back_small_transparent
        )
        self.button_back_transparent = (
            _uiv1assets.meshes.button_back_transparent
        )
        self.button_large_opaque = _uiv1assets.meshes.button_large_opaque
        self.button_large_transparent = (
            _uiv1assets.meshes.button_large_transparent
        )
        self.button_larger_opaque = _uiv1assets.meshes.button_larger_opaque
        self.button_larger_transparent = (
            _uiv1assets.meshes.button_larger_transparent
        )
        self.button_medium_opaque = _uiv1assets.meshes.button_medium_opaque
        self.button_medium_transparent = (
            _uiv1assets.meshes.button_medium_transparent
        )
        self.button_small_opaque = _uiv1assets.meshes.button_small_opaque
        self.button_small_transparent = (
            _uiv1assets.meshes.button_small_transparent
        )
        self.button_square_opaque = _uiv1assets.meshes.button_square_opaque
        self.button_square_transparent = (
            _uiv1assets.meshes.button_square_transparent
        )
        self.button_tab_opaque = _uiv1assets.meshes.button_tab_opaque
        self.button_tab_transparent = _uiv1assets.meshes.button_tab_transparent
        self.check_transparent = _uiv1assets.meshes.check_transparent
        self.image1x1 = _uiv1assets.meshes.image1x1
        self.scroll_bar_thumb_opaque = (
            _uiv1assets.meshes.scroll_bar_thumb_opaque
        )
        self.scroll_bar_thumb_short_opaque = (
            _uiv1assets.meshes.scroll_bar_thumb_short_opaque
        )
        self.scroll_bar_thumb_short_transparent = (
            _uiv1assets.meshes.scroll_bar_thumb_short_transparent
        )
        self.scroll_bar_thumb_transparent = (
            _uiv1assets.meshes.scroll_bar_thumb_transparent
        )
        self.scroll_bar_trough_transparent = (
            _uiv1assets.meshes.scroll_bar_trough_transparent
        )
        self.soft_edge_outside = _uiv1assets.meshes.soft_edge_outside
        self.text_box_transparent = _uiv1assets.meshes.text_box_transparent
        self.window_hsmall_vmed_opaque = (
            _uiv1assets.meshes.window_hsmall_vmed_opaque
        )
        self.window_hsmall_vmed_transparent = (
            _uiv1assets.meshes.window_hsmall_vmed_transparent
        )
        self.window_hsmall_vsmall_opaque = (
            _uiv1assets.meshes.window_hsmall_vsmall_opaque
        )
        self.window_hsmall_vsmall_transparent = (
            _uiv1assets.meshes.window_hsmall_vsmall_transparent
        )
        self.swish = _uiv1assets.audio.swish
        self.swish2 = _uiv1assets.audio.swish2
        self.swish3 = _uiv1assets.audio.swish3
        self.score_increase = _uiv1assets.audio.score_increase


def set_ui_asset_set(assets: UIAssetSet) -> None:
    """Supply the assets the ui_v1 widget layer draws itself with.

    Called by an app-mode during activation (normally from
    :meth:`~babase.AppMode.on_activate`, with the
    :class:`UIAssetSet` carried by its app-mode config), before
    asking the native layer to activate the mode -- ui_v1 reads
    the set as it builds its widgets. Calling more than once is
    fine: the last call before an activation is the one that
    takes effect. Note that a call made while ui_v1 is already
    active does not restyle the live ui; it applies at the next
    activation (which happens on every session change).

    The supplied art is wiped by ui_v1's app-subsystem
    :meth:`~babase.AppSubsystem.reset` at every app-mode switch,
    so a mode can never inherit a previous mode's art. A
    ui-using mode that never supplies its own gets a disabled
    ('zombie') ui and a logged error rather than a crash.
    """
    # This is where loading actually happens: slots hold handles
    # until applied, so replaced defaults are never loaded.
    # Positional, in spec order -- the native side is generated
    # from the same spec, so the two cannot drift.
    loaded: list[bauiv1.Texture | bauiv1.Mesh | bauiv1.Sound] = []
    for name, handle in (
        ('back_icon', assets.back_icon),
        ('bomb_button', assets.bomb_button),
        ('button_square', assets.button_square),
        ('button_square_wide', assets.button_square_wide),
        ('circle', assets.circle),
        ('circle_soft', assets.circle_soft),
        ('glow', assets.glow),
        ('menu_button', assets.menu_button),
        ('nub', assets.nub),
        ('page_left_right', assets.page_left_right),
        ('scroll_widget', assets.scroll_widget),
        ('scroll_widget_glow', assets.scroll_widget_glow),
        ('shadow_sharp', assets.shadow_sharp),
        ('spinner', assets.spinner),
        ('spinner0', assets.spinner0),
        ('spinner1', assets.spinner1),
        ('spinner10', assets.spinner10),
        ('spinner11', assets.spinner11),
        ('spinner2', assets.spinner2),
        ('spinner3', assets.spinner3),
        ('spinner4', assets.spinner4),
        ('spinner5', assets.spinner5),
        ('spinner6', assets.spinner6),
        ('spinner7', assets.spinner7),
        ('spinner8', assets.spinner8),
        ('spinner9', assets.spinner9),
        ('start_button', assets.start_button),
        ('text_clear_button', assets.text_clear_button),
        ('ui_atlas', assets.ui_atlas),
        ('ui_atlas2', assets.ui_atlas2),
        ('users_button', assets.users_button),
        ('white', assets.white),
        ('window_hsmall_vmed', assets.window_hsmall_vmed),
        ('window_hsmall_vsmall', assets.window_hsmall_vsmall),
        ('button_back_opaque', assets.button_back_opaque),
        ('button_back_small_opaque', assets.button_back_small_opaque),
        (
            'button_back_small_transparent',
            assets.button_back_small_transparent,
        ),
        ('button_back_transparent', assets.button_back_transparent),
        ('button_large_opaque', assets.button_large_opaque),
        ('button_large_transparent', assets.button_large_transparent),
        ('button_larger_opaque', assets.button_larger_opaque),
        ('button_larger_transparent', assets.button_larger_transparent),
        ('button_medium_opaque', assets.button_medium_opaque),
        ('button_medium_transparent', assets.button_medium_transparent),
        ('button_small_opaque', assets.button_small_opaque),
        ('button_small_transparent', assets.button_small_transparent),
        ('button_square_opaque', assets.button_square_opaque),
        ('button_square_transparent', assets.button_square_transparent),
        ('button_tab_opaque', assets.button_tab_opaque),
        ('button_tab_transparent', assets.button_tab_transparent),
        ('check_transparent', assets.check_transparent),
        ('image1x1', assets.image1x1),
        ('scroll_bar_thumb_opaque', assets.scroll_bar_thumb_opaque),
        (
            'scroll_bar_thumb_short_opaque',
            assets.scroll_bar_thumb_short_opaque,
        ),
        (
            'scroll_bar_thumb_short_transparent',
            assets.scroll_bar_thumb_short_transparent,
        ),
        ('scroll_bar_thumb_transparent', assets.scroll_bar_thumb_transparent),
        (
            'scroll_bar_trough_transparent',
            assets.scroll_bar_trough_transparent,
        ),
        ('soft_edge_outside', assets.soft_edge_outside),
        ('text_box_transparent', assets.text_box_transparent),
        ('window_hsmall_vmed_opaque', assets.window_hsmall_vmed_opaque),
        (
            'window_hsmall_vmed_transparent',
            assets.window_hsmall_vmed_transparent,
        ),
        ('window_hsmall_vsmall_opaque', assets.window_hsmall_vsmall_opaque),
        (
            'window_hsmall_vsmall_transparent',
            assets.window_hsmall_vsmall_transparent,
        ),
        ('swish', assets.swish),
        ('swish2', assets.swish2),
        ('swish3', assets.swish3),
        ('score_increase', assets.score_increase),
        ('level_icon', assets.level_icon),
        ('trophy', assets.trophy),
        ('chest_icon_empty', assets.chest_icon_empty),
        ('log_icon', assets.log_icon),
        ('leaderboards_icon', assets.leaderboards_icon),
        ('inventory_icon', assets.inventory_icon),
        ('store_icon', assets.store_icon),
        ('store_character_xmas', assets.store_character_xmas),
        ('coin', assets.coin),
        ('tickets', assets.tickets),
        ('lock', assets.lock),
        ('tv', assets.tv),
        ('achievements_icon', assets.achievements_icon),
        ('settings_icon', assets.settings_icon),
        ('currency_meter', assets.currency_meter),
        ('currency_plus_button', assets.currency_plus_button),
        ('toolbar_backing_top2', assets.toolbar_backing_top2),
        ('toolbar_backing_bottom2', assets.toolbar_backing_bottom2),
    ):
        try:
            loaded.append(handle.get())
        except Exception as exc:
            # The chained error names the exact asset and
            # package; the slot is what it cannot know.
            raise RuntimeError(
                f'Error loading the ui asset for slot {name!r}.'
            ) from exc
    _bauiv1.set_ui_asset_set_native(*loaded)
