module IRC.Data.Message 
    (IRCMessage) where

import System.Environment
import System.IO
import Data.List
import Control.Monad.Reader
import Data.Aeson
import qualified Data.Text as T

import IRC.Network
import qualified IRC.Agent as IA


class IRCMsg m where
    send :: m -> IA.AgentIO ()

sendMaybeMessage :: String -> Sting -> Maybe Handle -> Maybe IO ()

data PassMsg = PassMsg String

instance IRCMsg PassMsg where
    send m = do
        a <- ask
        let mh = IA.conn a
        liftIO $ case mh of
            Nothing -> putStrLn "Could not Send Command"
            Just h -> write "PASS" m mh

data NickMsg = NickMsg String

instance IRCMsg PassMsg where
    send m = do
        a <- ask
        let mh = IA.conn a
        liftIO $ case mh of
            Nothing -> putStrLn "Could not Send Command"
            Just h -> write "NICK" m mh

data UserMsg = UserMsg String String String String

data JoinMsg = JoinMsg [String]

data PrivMsg = PrivMsg [String] String

data PongMsg = PongMsg String

data PingMsg = PingMsg String
