content: {-# LANGUAGE OverloadedStrings #-}
  
  module Tests.DataForms where
  
  import Network.Xmpp.Xep.DataForms
  
  import qualified Data.Text.Lazy as TL
  import qualified Text.XML.Stream.Elements as Elements
  import qualified Data.XML.Types as XML
  import Data.XML.Pickle
  
  exampleXML1 = TL.concat $
            ["<x xmlns='jabber:x:data' type='form'>"
            ,"<title>Bot Configuration</title>"
            ,"<instructions>Fill out this form to configure your new bot!</instructions>"
            ,"<field type='hidden'"
            ,"var='FORM_TYPE'>"
            ,"<value>jabber:bot</value>"
            ,"</field>"
            ,"<field type='fixed'><value>Section 1: Bot Info</value></field>"
            ,"<field type='text-single'"
            ,"label='The name of your bot'"
            ,"var='botname'/>"
            ,"<field type='text-multi'"
            ,"label='Helpful description of your bot'"
            ,"var='description'/>"
            ,"<field type='boolean'"
            ,"label='Public bot?'"
            ,"var='public'>"
            ,"<required/>"
            ,"</field>"
            ,"<field type='text-private'"
            ,"label='Password for special access'"
            ,"var='password'/>"
            ,"<field type='fixed'><value>Section 2: Features</value></field>"
            ,"<field type='list-multi'"
            ,"label='What features will the bot support?'"
            ,"var='features'>"
            ,"<option label='Contests'><value>contests</value></option>"
            ,"<option label='News'><value>news</value></option>"
            ,"<option label='Polls'><value>polls</value></option>"
            ,"<option label='Reminders'><value>reminders</value></option>"
            ,"<option label='Search'><value>search</value></option>"
            ,"<value>news</value>"
            ,"<value>search</value>"
            ,"</field>"
            ,"<field type='fixed'><value>Section 3: Subscriber List</value></field>"
            ,"<field type='list-single'"
            ,"label='Maximum number of subscribers'"
            ,"var='maxsubs'>"
            ,"<value>20</value>"
            ,"<option label='10'><value>10</value></option>"
            ,"<option label='20'><value>20</value></option>"
            ,"<option label='30'><value>30</value></option>"
            ,"<option label='50'><value>50</value></option>"
            ,"<option label='100'><value>100</value></option>"
            ,"<option label='None'><value>none</value></option>"
            ,"</field>"
            ,"<field type='fixed'><value>Section 4: Invitations</value></field>"
            ,"<field type='jid-multi'"
            ,"label='People to invite'"
            ,"var='invitelist'>"
            ,"<desc>Tell all your friends about your new bot!</desc>"
            ,"</field>"
            ,"</x>"]
  
  exampleXml2 = TL.concat [
         "   <x xmlns='jabber:x:data' type='submit'>"
        ,"      <field type='hidden' var='FORM_TYPE'>"
        ,"        <value>jabber:bot</value>"
        ,"      </field>"
        ,"      <field type='text-single' var='botname'>"
        ,"        <value>The Jabber Google Bot</value>"
        ,"      </field>"
        ,"      <field type='text-multi' var='description'>"
        ,"        <value>This bot enables you to send requests to</value>"
        ,"        <value>Google and receive the search results right</value>"
        ,"        <value>in your Jabber client. It&apos; really cool!</value>"
        ,"        <value>It even supports Google News!</value>"
        ,"      </field>"
        ,"      <field type='boolean' var='public'>"
        ,"        <value>0</value>"
        ,"      </field>"
        ,"      <field type='text-private' var='password'>"
        ,"        <value>v3r0na</value>"
        ,"      </field>"
        ,"      <field type='list-multi' var='features'>"
        ,"        <value>news</value>"
        ,"        <value>search</value>"
        ,"      </field>"
        ,"      <field type='list-single' var='maxsubs'>"
        ,"        <value>50</value>"
        ,"      </field>"
        ,"      <field type='jid-multi' var='invitelist'>"
        ,"        <value>juliet@capulet.com</value>"
        ,"        <value>benvolio@montague.net</value>"
        ,"      </field>"
        ,"    </x>"]
  
  
  exampleXml3 = TL.concat [
        " <x xmlns='jabber:x:data' type='result'>"
      , "      <field type='hidden' var='FORM_TYPE'>"
      , "        <value>jabber:bot</value>"
      , "      </field>"
      , "      <field type='text-single' var='botname'>"
      , "        <value>The Jabber Google Bot</value>"
      , "      </field>"
      , "      <field type='boolean' var='public'>"
      , "        <value>0</value>"
      , "      </field>"
      , "      <field type='text-private' var='password'>"
      , "        <value>v3r0na</value>"
      , "      </field>"
      , "      <field type='list-multi' var='features'>"
      , "        <value>news</value>"
      , "        <value>search</value>"
      , "      </field>"
      , "      <field type='list-single' var='maxsubs'>"
      , "        <value>50</value>"
      , "      </field>"
      , "      <field type='jid-multi' var='invitelist'>"
      , "        <value>juliet@capulet.com</value>"
      , "        <value>benvolio@montague.net</value>"
      , "      </field>"
      , "    </x>"]
  
  parseForm = unpickleTree (xpRoot xpForm) . XML.NodeElement . Elements.parseElement
  