import { FLAGS, useFeatureIsOn } from '@komi-app/flags-sdk'

export const useHasSMS = () => {
  const useTiers = useFeatureIsOn(FLAGS.USE_TIERS_TALENT)
  const isTopCreator = useFeatureIsOn(FLAGS.TIER_CREATOR_TOP)
  const isSMSFeatureEnabled = useFeatureIsOn(FLAGS.DCA_SMS_CAMPAIGNS_SCHEDULE)

  // Without tiers, SMS is enabled if the feature flag is on
  if (!useTiers) {
    return isSMSFeatureEnabled
  }

  // If tiers are enabled, we only allow SMS For top creators
  return isSMSFeatureEnabled && isTopCreator
}
