module EventLoop.Output.OutputEvent where

import EventLoop.Output.Graphical.Graphical
import EventLoop.Output.SystemMessage
import EventLoop.Config
import EventLoop.Json

data OutputEvent = OutGraphical Graphical
                 | OutSysMessage [SystemMessageOut]
                
                
instance JSONAble OutputEvent where
    toJsonMessage (OutGraphical graph)   = JSONObject [(JSONMember modeS (JSONString graphicalS)), (JSONMember commandS (toJsonMessage graph))]
    toJsonMessage (OutSysMessage ms)  = JSONObject [(JSONMember modeS (JSONString sysmessageanswersS)), (JSONMember answersS (JSONArray (map toJsonMessage ms)))]