content: {-# LANGUAGE BangPatterns, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses, TemplateHaskell #-}
  {-# OPTIONS_GHC -fno-warn-unused-imports #-}
  module Network.Riak.Protocol.DtValue (DtValue(..)) where
  import Prelude ((+), (/))
  import qualified Prelude as Prelude'
  import qualified Data.Typeable as Prelude'
  import qualified Data.Data as Prelude'
  import qualified Text.ProtocolBuffers.Header as P'
  import qualified Network.Riak.Protocol.MapEntry as Protocol (MapEntry)
   
  data DtValue = DtValue{counter_value :: !(P'.Maybe P'.Int64), set_value :: !(P'.Seq P'.ByteString),
                         map_value :: !(P'.Seq Protocol.MapEntry)}
               deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data)
   
  instance P'.Mergeable DtValue where
    mergeAppend (DtValue x'1 x'2 x'3) (DtValue y'1 y'2 y'3)
     = DtValue (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3)
   
  instance P'.Default DtValue where
    defaultValue = DtValue P'.defaultValue P'.defaultValue P'.defaultValue
   
  instance P'.Wire DtValue where
    wireSize ft' self'@(DtValue x'1 x'2 x'3)
     = case ft' of
         10 -> calc'Size
         11 -> P'.prependMessageSize calc'Size
         _ -> P'.wireSizeErr ft' self'
      where
          calc'Size = (P'.wireSizeOpt 1 18 x'1 + P'.wireSizeRep 1 12 x'2 + P'.wireSizeRep 1 11 x'3)
    wirePut ft' self'@(DtValue x'1 x'2 x'3)
     = case ft' of
         10 -> put'Fields
         11 -> do
                 P'.putSize (P'.wireSize 10 self')
                 put'Fields
         _ -> P'.wirePutErr ft' self'
      where
          put'Fields
           = do
               P'.wirePutOpt 8 18 x'1
               P'.wirePutRep 18 12 x'2
               P'.wirePutRep 26 11 x'3
    wireGet ft'
     = case ft' of
         10 -> P'.getBareMessageWith update'Self
         11 -> P'.getMessageWith update'Self
         _ -> P'.wireGetErr ft'
      where
          update'Self wire'Tag old'Self
           = case wire'Tag of
               8 -> Prelude'.fmap (\ !new'Field -> old'Self{counter_value = Prelude'.Just new'Field}) (P'.wireGet 18)
               18 -> Prelude'.fmap (\ !new'Field -> old'Self{set_value = P'.append (set_value old'Self) new'Field}) (P'.wireGet 12)
               26 -> Prelude'.fmap (\ !new'Field -> old'Self{map_value = P'.append (map_value old'Self) new'Field}) (P'.wireGet 11)
               _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
   
  instance P'.MessageAPI msg' (msg' -> DtValue) DtValue where
    getVal m' f' = f' m'
   
  instance P'.GPB DtValue
   
  instance P'.ReflectDescriptor DtValue where
    getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [8, 18, 26])
    reflectDescriptorInfo _
     = Prelude'.read
        "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Protocol.DtValue\", haskellPrefix = [MName \"Network\",MName \"Riak\"], parentModule = [MName \"Protocol\"], baseName = MName \"DtValue\"}, descFilePath = [\"Network\",\"Riak\",\"Protocol\",\"DtValue.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Protocol.DtValue.counter_value\", haskellPrefix' = [MName \"Network\",MName \"Riak\"], parentModule' = [MName \"Protocol\",MName \"DtValue\"], baseName' = FName \"counter_value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 18}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Protocol.DtValue.set_value\", haskellPrefix' = [MName \"Network\",MName \"Riak\"], parentModule' = [MName \"Protocol\",MName \"DtValue\"], baseName' = FName \"set_value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Protocol.DtValue.map_value\", haskellPrefix' = [MName \"Network\",MName \"Riak\"], parentModule' = [MName \"Protocol\",MName \"DtValue\"], baseName' = FName \"map_value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Protocol.MapEntry\", haskellPrefix = [MName \"Network\",MName \"Riak\"], parentModule = [MName \"Protocol\"], baseName = MName \"MapEntry\"}), hsRawDefault = Nothing, hsDefault = Nothing}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"
   
  instance P'.TextType DtValue where
    tellT = P'.tellSubMessage
    getT = P'.getSubMessage
   
  instance P'.TextMsg DtValue where
    textPut msg
     = do
         P'.tellT "counter_value" (counter_value msg)
         P'.tellT "set_value" (set_value msg)
         P'.tellT "map_value" (map_value msg)
    textGet
     = do
         mods <- P'.sepEndBy (P'.choice [parse'counter_value, parse'set_value, parse'map_value]) P'.spaces
         Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
      where
          parse'counter_value
           = P'.try
              (do
                 v <- P'.getT "counter_value"
                 Prelude'.return (\ o -> o{counter_value = v}))
          parse'set_value
           = P'.try
              (do
                 v <- P'.getT "set_value"
                 Prelude'.return (\ o -> o{set_value = P'.append (set_value o) v}))
          parse'map_value
           = P'.try
              (do
                 v <- P'.getT "map_value"
                 Prelude'.return (\ o -> o{map_value = P'.append (map_value o) v}))