import { SettingsObject } from '../types/types'

export const useEffectiveSettings = (settings: SettingsObject, mode: string, secondaryBehavior: string) => {
  const effectiveMode =
    !settings['critical_css_mode'] || settings['critical_css_mode'] === 'default'
      ? mode
      : settings['critical_css_mode']

  const effectiveSecondaryBehavior =
    !settings['secondary_css_behavior'] || settings['secondary_css_behavior'] === 'default'
      ? secondaryBehavior
      : settings['secondary_css_behavior']

  return { effectiveMode, effectiveSecondaryBehavior }
}
