import os
from analogai.foundation.common.enums.relationship_type_positivity_threshold import RelationshipTypePositivityThreshold
from analogai.foundation.common.utils.env_utils import (
    get_optional_env,
    get_required_env,
    load_envs_in_order,
    parse_bool,
    parse_optional_float,
)


load_envs_in_order()


ENVIRONMENT = os.getenv('ENVIRONMENT', 'development')

if ENVIRONMENT not in ['development', 'production']:
    raise ValueError(
        "Environment variable ENVIRONMENT must be one of: development or production"
    )
print(f"Environment is set to {ENVIRONMENT} at Foundation")

DEBUG = parse_bool(os.getenv('DEBUG', 'true'), True)
LEMMATIZATION_ENABLED = parse_bool(os.getenv('LEMMATIZATION_ENABLED', 'false'), False)

VARIANCE_THRESHOLD = 0.1

RELATIONSHIP_TYPE_POSITIVITY_THRESHOLD_NEGATIVE = (
    parse_optional_float(
        os.getenv(
            'RELATIONSHIP_TYPE_POSITIVITY_THRESHOLD_NEGATIVE',
            str(RelationshipTypePositivityThreshold.NEGATIVE.value),
        ),
        RelationshipTypePositivityThreshold.NEGATIVE.value,
    )
    or RelationshipTypePositivityThreshold.NEGATIVE.value
)
RELATIONSHIP_TYPE_POSITIVITY_THRESHOLD_UNCERTAIN = (
    parse_optional_float(
        os.getenv(
            'RELATIONSHIP_TYPE_POSITIVITY_THRESHOLD_UNCERTAIN',
            str(RelationshipTypePositivityThreshold.UNCERTAIN.value),
        ),
        RelationshipTypePositivityThreshold.UNCERTAIN.value,
    )
    or RelationshipTypePositivityThreshold.UNCERTAIN.value
)
