"""gvsdsdk.auth — ELT 用户认证模块"""

__all__ = [
    'ELTAuthentication',
    'ELT_COOKIE_NAME', 'ELT_COOKIE_DOMAIN', 'ELT_COOKIE_MAX_AGE', 'SetELTCookie', 'DeleteELTCookie',
    'HashPassword', 'VerifyPassword', 'SymmetricEncrypt', 'SymmetricDecrypt', 'FileSHA1', 'FileSHA256', 'BytesSHA1', 'BytesSHA256',
    'ELTAuthMiddleware', 'CurrentRoleMiddleware',
    'IsAdminUser', 'IsCompanyMember', 'CompanyScopedMixin', 'PermissionVerifier',
    'RoleManager', 'ShopManager', 'PositionManager',
]


def __getattr__(name):
    if name == 'ELTAuthentication':
        from gvsdsdk.auth.elt_auth import ELTAuthentication
        globals()['ELTAuthentication'] = ELTAuthentication
        return ELTAuthentication
    if name in ('ELT_COOKIE_NAME', 'ELT_COOKIE_DOMAIN', 'ELT_COOKIE_MAX_AGE', 'SetELTCookie', 'DeleteELTCookie'):
        from gvsdsdk.auth import cookie as _m
        val = getattr(_m, name)
        globals()[name] = val
        return val
    if name in ('HashPassword', 'VerifyPassword', 'SymmetricEncrypt', 'SymmetricDecrypt', 'FileSHA1', 'FileSHA256', 'BytesSHA1', 'BytesSHA256'):
        from gvsdsdk.auth import crypto as _m
        val = getattr(_m, name)
        globals()[name] = val
        return val
    if name in ('ELTAuthMiddleware', 'CurrentRoleMiddleware'):
        from gvsdsdk.auth import middleware as _m
        val = getattr(_m, name)
        globals()[name] = val
        return val
    if name in ('IsAdminUser', 'IsCompanyMember', 'CompanyScopedMixin', 'PermissionVerifier'):
        from gvsdsdk.auth import permissions as _m
        val = getattr(_m, name)
        globals()[name] = val
        return val
    if name == 'RoleManager':
        from gvsdsdk.auth.managers import RoleManager
        globals()['RoleManager'] = RoleManager
        return RoleManager
    if name == 'ShopManager':
        from gvsdsdk.auth.managers import ShopManager
        globals()['ShopManager'] = ShopManager
        return ShopManager
    if name == 'PositionManager':
        from gvsdsdk.auth.managers import PositionManager
        globals()['PositionManager'] = PositionManager
        return PositionManager
    raise AttributeError(f"module 'gvsdsdk.auth' has no attribute {name!r}")
