# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========

from mirage.context import (get_current_session, get_current_session_for,
                            reset_current_session, set_current_session)
from mirage.workspace.session.errors import ReadonlyVariableError
from mirage.workspace.session.manager import SessionManager
from mirage.workspace.session.permissions import (CommandsBlock,
                                                  CompiledProfile,
                                                  MountCommandsBlock,
                                                  PathsBlock, ProfileMount,
                                                  SessionProfile, VarsBlock)
from mirage.workspace.session.ram import RAMSessionStore
from mirage.workspace.session.session import Session
from mirage.workspace.session.state import (ensure_var_visible, env_snapshot,
                                            exported_names, session_view,
                                            visible_arrays, visible_env)
from mirage.workspace.session.store import SessionFields, SessionStore

__all__ = [
    "RAMSessionStore",
    "ReadonlyVariableError",
    "env_snapshot",
    "ensure_var_visible",
    "exported_names",
    "SessionProfile",
    "CommandsBlock",
    "CompiledProfile",
    "MountCommandsBlock",
    "PathsBlock",
    "ProfileMount",
    "VarsBlock",
    "session_view",
    "visible_arrays",
    "visible_env",
    "RedisSessionStore",
    "S3SessionStore",
    "Session",
    "SessionFields",
    "SessionManager",
    "SessionStore",
    "get_current_session",
    "get_current_session_for",
    "reset_current_session",
    "set_current_session",
]


def __getattr__(name: str):
    if name == "RedisSessionStore":
        from mirage.workspace.session.redis import RedisSessionStore
        return RedisSessionStore
    if name == "S3SessionStore":
        from mirage.workspace.session.s3 import S3SessionStore
        return S3SessionStore
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
