-- Generated by protobuf-simple. DO NOT EDIT!
module Types.EnumOptMsg where

import Control.Applicative ((<$>))
import Prelude ()
import qualified Data.ProtoBufInt as PB
import qualified Types.Enum

newtype EnumOptMsg = EnumOptMsg
  { value :: PB.Maybe Types.Enum.Enum
  } deriving (PB.Show, PB.Eq, PB.Ord)

instance PB.Default EnumOptMsg where
  defaultVal = EnumOptMsg
    { value = PB.defaultVal
    }

instance PB.Mergeable EnumOptMsg where
  merge a b = EnumOptMsg
    { value = PB.merge (value a) (value b)
    }

instance PB.Required EnumOptMsg where
  reqTags _ = PB.fromList []

instance PB.WireMessage EnumOptMsg where
  fieldToValue (PB.WireTag 1 PB.VarInt) self = (\v -> self{value = PB.merge (value self) v}) <$> PB.getEnumOpt
  fieldToValue tag self = PB.getUnknown tag self

  messageToFields self = do
    PB.putEnumOpt (PB.WireTag 1 PB.VarInt) (value self)


