--=============================================================================
-- File:	CH_Help.lua
-- Author:	rudy
-- Description:	Help pages and config
--=============================================================================

CHH_FriendHPLabelOptions = {PERCENT       = CHHT_FRIEND_HP_LABEL_PERCENT,
                            PERCENT_SIGN  = CHHT_FRIEND_HP_LABEL_PERCENT_SIGN,
                            CURRENT       = CHHT_FRIEND_HP_LABEL_CURRENT,
                            MISSING       = CHHT_FRIEND_HP_LABEL_MISSING,
                            NONE          = CHHT_FRIEND_HP_LABEL_NONE};
CHH_FriendPartyLabelOptions    = {CLASS = CHHT_FRIEND_PARTY_LABEL_CLASS,
                                  NAME  = CHHT_FRIEND_PARTY_LABEL_NAME,
                                  BOTH  = CHHT_FRIEND_PARTY_LABEL_BOTH,
                                  COLOR = CHHT_FRIEND_PARTY_LABEL_COLOR};
CHH_FriendDebuffsOptions = {NONE    = CHHT_FRIEND_FRIEND_DEBUFF_NONE,
                            CURABLE = CHHT_FRIEND_FRIEND_DEBUFF_CURABLE,
                            ALL     = CHHT_FRIEND_FRIEND_DEBUFF_ALL};
CHH_FriendResurrectDruidOptions = {AFTER_COMBAT = CHHT_FRIEND_RESURRECT_AFTER_COMBAT,
                                   ALWAYS       = CHHT_FRIEND_RESURRECT_ALWAYS,
                                   NEVER        = CHHT_FRIEND_RESURRECT_NEVER};
CHH_FriendResurrectOtherOptions = {AFTER_COMBAT = CHHT_FRIEND_RESURRECT_AFTER_COMBAT,
                                   NEVER        = CHHT_FRIEND_RESURRECT_NEVER};
CHH_FriendFrameBackgroundOptions = { HEALTH = CHHT_FRIEND_FRAME_BACKGROUND_HEALTH,
                                     CLASS  = CHHT_FRIEND_FRAME_BACKGROUND_CLASS,
                                     BLACK  = CHHT_FRIEND_FRAME_BACKGROUND_BLACK,
                                     TRANS  = CHHT_FRIEND_FRAME_BACKGROUND_TRANS};
CHH_FriendCheckHealRangeOptions = {NEVER  = CHHT_FRIEND_CHECK_HEAL_RANGE_NEVER,
				   FOLLOW = CHHT_FRIEND_CHECK_HEAL_RANGE_FOLLOW};
--                                 TARGET = CHHT_FRIEND_CHECK_HEAL_RANGE_TARGET};

-- ============================================================================
--   friend config             
-- ============================================================================

function CHH_FriendInit()

  local playerClass = CH_UnitClass( 'player' );

  CHH_InitTabs( CHH_Friend, CHH_FriendGeneral, 'FRIEND', 'MISC', CHH_FriendInit, nil );

  if ( playerClass == 'PRIEST' ) then
    CHH_FriendGeneralFinetuneSpell1Name:SetText( CHHT_FRIEND_POWER_WORD_SHIELD );
    CHH_FriendGeneralFinetuneSpell1:SetChecked( CH_Config.finetunePwS );
    CHH_FriendGeneralFinetuneSpell2Name:SetText( CHHT_FRIEND_RENEW );
    CHH_FriendGeneralFinetuneSpell2:SetChecked( CH_Config.finetuneRenew );
  elseif ( playerClass == 'DRUID' ) then
    CHH_FriendGeneralFinetuneSpell1Name:SetText( CHHT_FRIEND_REGROWTH );
    CHH_FriendGeneralFinetuneSpell1:SetChecked( CH_Config.finetuneRegrowth );
    CHH_FriendGeneralFinetuneSpell2Name:SetText( CHHT_FRIEND_REJUVENATION );
    CHH_FriendGeneralFinetuneSpell2:SetChecked( CH_Config.finetuneRejuvenation );
  else
    CHH_FriendGeneralFinetuneSpell1:Hide();
    CHH_FriendGeneralFinetuneSpell1Name:Hide();
    CHH_FriendGeneralFinetuneSpell2:Hide();
    CHH_FriendGeneralFinetuneSpell2Name:Hide();
  end

end

function CHH_FriendGeneralFinetuneSpell1Clicked()

  local playerClass = CH_UnitClass( 'player' );

  if ( playerClass == 'PRIEST' ) then
    CH_Config.finetunePwS = CH_ToBoolean( this:GetChecked() );
  elseif ( playerClass == 'DRUID' ) then
    CH_Config.finetuneRegrowth = CH_ToBoolean( this:GetChecked() );
  end

end

function CHH_FriendGeneralFinetuneSpell2Clicked()

  local playerClass = CH_UnitClass( 'player' );

  if ( playerClass == 'PRIEST' ) then
    CH_Config.finetuneRenew = CH_ToBoolean( this:GetChecked() );
  elseif ( playerClass == 'DRUID' ) then
    CH_Config.finetuneRejuvenation = CH_ToBoolean( this:GetChecked() );
  end

end
