from core.configuration.feature_flags_enum import FeatureFlagsEnum
from data.schemas.system.feature_flag_dao import featureFlagDao


class FeatureFlags:
    _flags = {
        FeatureFlagsEnum.version_endpoint.value: True,  # 15.01.2025
    }

    @staticmethod
    def get_default(key: FeatureFlagsEnum) -> bool:
        return FeatureFlags._flags[key.value]

    @staticmethod
    async def has_feature(key: FeatureFlagsEnum) -> bool:
        value = await featureFlagDao.find_by_key(key.value)
        if value is None:
            return False

        return value.value
