export function isFeatureGateEnabled(featureFlags, flagId) {
    if (!featureFlags)
        return true;
    return featureFlags.isEnabled(flagId);
}
export function requireFeatureGate(featureFlags, flagId, operation) {
    if (isFeatureGateEnabled(featureFlags, flagId))
        return;
    throw new Error(`${flagId} feature flag is disabled; cannot ${operation}`);
}
export function surfaceFeatureGateId(surface) {
    switch (surface) {
        case 'web':
            return 'web-surface';
        case 'slack':
            return 'slack-surface';
        case 'discord':
            return 'discord-surface';
        case 'ntfy':
            return 'ntfy-surface';
        case 'webhook':
            return 'webhook-surface';
        case 'homeassistant':
            return 'homeassistant-surface';
        default:
            return null;
    }
}
export function isSurfaceFeatureGateEnabled(featureFlags, surface) {
    if (!featureFlags)
        return true;
    if (surface === 'tui' || surface === 'service')
        return true;
    const flagId = surfaceFeatureGateId(surface);
    return flagId ? featureFlags.isEnabled(flagId) : false;
}
