# Copyright (c) 2023 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com

from pyfaaster.aws import handlers_decorators_v2 as faaster

from .constants import DEFAULT_NAMESPACE

DEFAULT_WAREHOUSE_NAME = 'GENERAL'


def get_cluster():
    return f'snowflake-environment-{get_environment()}'.lower()


@faaster.namespace_aware
def get_environment(*, NAMESPACE: str = DEFAULT_NAMESPACE) -> str:
    return 'PROD' if NAMESPACE == 'live' else 'DEV'


@faaster.namespace_aware
def get_default_warehouse(*, warehouse_name: str = DEFAULT_WAREHOUSE_NAME, NAMESPACE: str = DEFAULT_NAMESPACE) -> str:
    warehouse_namespace = 'live' if NAMESPACE == 'live' else 'alfa'  # all dev namespaces use the alfa warehouse
    return f'{get_environment()}_{warehouse_namespace}_{warehouse_name}'.upper()
