module YouTube
  class SwitchAccountsPage < BasePage
    button(:change_account_link, class: 'yt-masthead-user-icon')
    div(:accounts_container, id: 'yt-delegate-accounts')
    div(:current_account_name, class: 'yt-masthead-picker-name')
    links(:account_picker_links, class: 'yt-masthead-account-picker-option')
    div(:select_account_name, class: 'yt-masthead-picker-name')

    def switch_accounts(account)
      if account == 'The Orchard Music'
        cms_content_owner = ENV['THE_ORCHARD_MUSIC']
      elsif account == 'IODA'
        cms_content_owner = ENV['IODA']
      elsif account == 'The Orchard Entertainment'
        cms_content_owner = ENV['THE_ORCHARD_ENTERTAINMENT']
      elsif account == 'The Orchard Music Publishing'
        cms_content_owner = ENV['THE_ORCHARD_MUSIC_PUBLISHING']
      end
      @browser.goto("https://studio.youtube.com/owner/#{cms_content_owner}/reports/summary?o=#{cms_content_owner}")
    end
  end
end
