{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable,
  OverloadedStrings #-}
module Data.Bond.Schema.ProtocolType where
import qualified Data.Bond.Internal.Imports as B'
import qualified Prelude as P'

newtype ProtocolType = ProtocolType B'.Int32
                     deriving (P'.Show, P'.Eq, B'.NFData, P'.Ord, P'.Enum, B'.Hashable,
                               B'.Default, B'.Typeable)

instance B'.BondType ProtocolType where
        bondPut (ProtocolType v') = B'.bondPut v'
        bondGet = P'.fmap ProtocolType B'.bondGet
        getName _ = "ProtocolType"
        getQualifiedName _ = "bond.ProtocolType"
        getElementType _ = B'.ElementInt32

instance B'.BondEnum ProtocolType where
        toName (ProtocolType 0) = P'.Just "MARSHALED_PROTOCOL"
        toName (ProtocolType 17997) = P'.Just "FAST_PROTOCOL"
        toName (ProtocolType 16963) = P'.Just "COMPACT_PROTOCOL"
        toName (ProtocolType 19027) = P'.Just "SIMPLE_JSON_PROTOCOL"
        toName (ProtocolType 20563) = P'.Just "SIMPLE_PROTOCOL"
        toName _ = P'.Nothing
        fromName "MARSHALED_PROTOCOL" = P'.Just mARSHALED_PROTOCOL
        fromName "FAST_PROTOCOL" = P'.Just fAST_PROTOCOL
        fromName "COMPACT_PROTOCOL" = P'.Just cOMPACT_PROTOCOL
        fromName "SIMPLE_JSON_PROTOCOL" = P'.Just sIMPLE_JSON_PROTOCOL
        fromName "SIMPLE_PROTOCOL" = P'.Just sIMPLE_PROTOCOL
        fromName _ = P'.Nothing

mARSHALED_PROTOCOL, fAST_PROTOCOL, cOMPACT_PROTOCOL,
                    sIMPLE_JSON_PROTOCOL, sIMPLE_PROTOCOL :: ProtocolType
mARSHALED_PROTOCOL = ProtocolType 0
fAST_PROTOCOL = ProtocolType 17997
cOMPACT_PROTOCOL = ProtocolType 16963
sIMPLE_JSON_PROTOCOL = ProtocolType 19027
sIMPLE_PROTOCOL = ProtocolType 20563