packages feed

wireform-proto-0.1.0.0: src/Proto/Google/Protobuf/Reflection/Descriptor.hs

{-# LANGUAGE StrictData #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedRecordDot #-}
-- | Auto-generated protobuf types from package @google.protobuf@.
--
-- __THIS FILE IS AUTO-GENERATED BY wireform. DO NOT EDIT.__
--
-- Any manual changes will be overwritten the next time code
-- generation is run.  To modify the types or instances, edit the
-- @.proto@ source file and re-run the code generator.
module Proto.Google.Protobuf.Reflection.Descriptor where

import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Wireform.Builder as B
import Data.Int (Int32, Int64)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Word (Word8, Word32, Word64)
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Map.Strict as Map
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import GHC.Generics (Generic)
import Control.DeepSeq (NFData(..))
import Data.Hashable (Hashable(..))
import Proto.Internal.Encode
import Proto.Internal.Decode
import Proto.Internal.GrowList (GrowList, emptyGrowList, snocGrowList, growListToVector)
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Types as Aeson
import qualified Data.Aeson.Key as AesonKey
import qualified Data.Aeson.KeyMap as AesonKM
import Proto.Internal.JSON (jsonObject, (.=:), parseFieldMaybe, bytesFieldToJSON, parseBytesFieldMaybe, bytesMapFieldToJSON, parseBytesMapFieldMaybe, protoBytesToJSON, OneofVariantNullSemantics (..), parseOneofVariants)
import Data.Proxy (Proxy(..))
import Proto.Schema (ProtoMessage(..), SomeFieldDescriptor(..), FieldDescriptor(..), FieldTypeDescriptor(..), ScalarFieldType(..), FieldLabel'(..))
import Proto.Registry (IsMessage)
import Proto.Registry qualified
import qualified Proto.Extension
import Proto.Internal.Wire (Tag(..), WireType(..))
import Proto.Internal.Wire.Encode (putTag, putVarint, putFixed32, putFixed64,
  putFloat, putDouble, putText, putByteString, putLengthDelimited,
  putSVarint32, putSVarint64, putVarintSigned,
  varintSize, tagSize,
  varintSize32, zigZag32, zigZag64)
import Proto.Internal.Encode.Archetype (archVarint, archSVarint32, archSVarint64,
  archFixed32, archFixed64, archFloat, archDouble, archBool,
  archString, archBytes, archSubmessage)

-- | Serialized FileDescriptorProto for this .proto file.
-- Decode with @Proto.Decode.decodeMessage@.
fileDescriptorProtoBytes :: ByteString
fileDescriptorProtoBytes = "\x0a\x20\x67\x6f\x6f\x67\x6c\x65\x2f\x70\x72\x6f\x74\x6f\x62\x75\x66\x2f\x64\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x2e\x70\x72\x6f\x74\x6f\x12\x0f\x67\x6f\x6f\x67\x6c\x65\x2e\x70\x72\x6f\x74\x6f\x62\x75\x66\x22\x36\x0a\x11\x46\x69\x6c\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x53\x65\x74\x12\x21\x0a\x04\x66\x69\x6c\x65\x18\x01\x20\x03\x28\x0b\x32\x13\x46\x69\x6c\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x22\x8f\x03\x0a\x13\x46\x69\x6c\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x0f\x0a\x07\x70\x61\x63\x6b\x61\x67\x65\x18\x02\x20\x01\x28\x09\x12\x12\x0a\x0a\x64\x65\x70\x65\x6e\x64\x65\x6e\x63\x79\x18\x03\x20\x03\x28\x09\x12\x19\x0a\x11\x70\x75\x62\x6c\x69\x63\x5f\x64\x65\x70\x65\x6e\x64\x65\x6e\x63\x79\x18\x0a\x20\x03\x28\x05\x12\x17\x0a\x0f\x77\x65\x61\x6b\x5f\x64\x65\x70\x65\x6e\x64\x65\x6e\x63\x79\x18\x0b\x20\x03\x28\x05\x12\x25\x0a\x0c\x6d\x65\x73\x73\x61\x67\x65\x5f\x74\x79\x70\x65\x18\x04\x20\x03\x28\x0b\x32\x0f\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x26\x0a\x09\x65\x6e\x75\x6d\x5f\x74\x79\x70\x65\x18\x05\x20\x03\x28\x0b\x32\x13\x45\x6e\x75\x6d\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x27\x0a\x07\x73\x65\x72\x76\x69\x63\x65\x18\x06\x20\x03\x28\x0b\x32\x16\x53\x65\x72\x76\x69\x63\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x27\x0a\x09\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x18\x07\x20\x03\x28\x0b\x32\x14\x46\x69\x65\x6c\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x1c\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x08\x20\x01\x28\x0b\x32\x0b\x46\x69\x6c\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x28\x0a\x10\x73\x6f\x75\x72\x63\x65\x5f\x63\x6f\x64\x65\x5f\x69\x6e\x66\x6f\x18\x09\x20\x01\x28\x0b\x32\x0e\x53\x6f\x75\x72\x63\x65\x43\x6f\x64\x65\x49\x6e\x66\x6f\x12\x0e\x0a\x06\x73\x79\x6e\x74\x61\x78\x18\x0c\x20\x01\x28\x09\x12\x18\x0a\x07\x65\x64\x69\x74\x69\x6f\x6e\x18\x0e\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x22\xf0\x03\x0a\x0f\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x23\x0a\x05\x66\x69\x65\x6c\x64\x18\x02\x20\x03\x28\x0b\x32\x14\x46\x69\x65\x6c\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x27\x0a\x09\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x18\x06\x20\x03\x28\x0b\x32\x14\x46\x69\x65\x6c\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x24\x0a\x0b\x6e\x65\x73\x74\x65\x64\x5f\x74\x79\x70\x65\x18\x03\x20\x03\x28\x0b\x32\x0f\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x26\x0a\x09\x65\x6e\x75\x6d\x5f\x74\x79\x70\x65\x18\x04\x20\x03\x28\x0b\x32\x13\x45\x6e\x75\x6d\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x27\x0a\x0f\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x5f\x72\x61\x6e\x67\x65\x18\x05\x20\x03\x28\x0b\x32\x0e\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x52\x61\x6e\x67\x65\x12\x28\x0a\x0a\x6f\x6e\x65\x6f\x66\x5f\x64\x65\x63\x6c\x18\x08\x20\x03\x28\x0b\x32\x14\x4f\x6e\x65\x6f\x66\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x1f\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x07\x20\x01\x28\x0b\x32\x0e\x4d\x65\x73\x73\x61\x67\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x25\x0a\x0e\x72\x65\x73\x65\x72\x76\x65\x64\x5f\x72\x61\x6e\x67\x65\x18\x09\x20\x03\x28\x0b\x32\x0d\x52\x65\x73\x65\x72\x76\x65\x64\x52\x61\x6e\x67\x65\x12\x15\x0a\x0d\x72\x65\x73\x65\x72\x76\x65\x64\x5f\x6e\x61\x6d\x65\x18\x0a\x20\x03\x28\x09\x1a\x54\x0a\x0e\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x52\x61\x6e\x67\x65\x12\x0d\x0a\x05\x73\x74\x61\x72\x74\x18\x01\x20\x01\x28\x05\x12\x0b\x0a\x03\x65\x6e\x64\x18\x02\x20\x01\x28\x05\x12\x26\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x03\x20\x01\x28\x0b\x32\x15\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x52\x61\x6e\x67\x65\x4f\x70\x74\x69\x6f\x6e\x73\x1a\x2b\x0a\x0d\x52\x65\x73\x65\x72\x76\x65\x64\x52\x61\x6e\x67\x65\x12\x0d\x0a\x05\x73\x74\x61\x72\x74\x18\x01\x20\x01\x28\x05\x12\x0b\x0a\x03\x65\x6e\x64\x18\x02\x20\x01\x28\x05\x22\xce\x02\x0a\x15\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x52\x61\x6e\x67\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x12\x20\x0a\x0b\x64\x65\x63\x6c\x61\x72\x61\x74\x69\x6f\x6e\x18\x02\x20\x03\x28\x0b\x32\x0b\x44\x65\x63\x6c\x61\x72\x61\x74\x69\x6f\x6e\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x32\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x27\x0a\x0c\x76\x65\x72\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x18\x03\x20\x01\x28\x0b\x32\x11\x56\x65\x72\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x53\x74\x61\x74\x65\x1a\x62\x0a\x0b\x44\x65\x63\x6c\x61\x72\x61\x74\x69\x6f\x6e\x12\x0e\x0a\x06\x6e\x75\x6d\x62\x65\x72\x18\x01\x20\x01\x28\x05\x12\x11\x0a\x09\x66\x75\x6c\x6c\x5f\x6e\x61\x6d\x65\x18\x02\x20\x01\x28\x09\x12\x0c\x0a\x04\x74\x79\x70\x65\x18\x03\x20\x01\x28\x09\x12\x10\x0a\x08\x72\x65\x73\x65\x72\x76\x65\x64\x18\x05\x20\x01\x28\x08\x12\x10\x0a\x08\x72\x65\x70\x65\x61\x74\x65\x64\x18\x06\x20\x01\x28\x08\x22\x34\x0a\x11\x56\x65\x72\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x53\x74\x61\x74\x65\x12\x0f\x0a\x0b\x44\x45\x43\x4c\x41\x52\x41\x54\x49\x4f\x4e\x10\x00\x12\x0e\x0a\x0a\x55\x4e\x56\x45\x52\x49\x46\x49\x45\x44\x10\x01\x22\xf8\x04\x0a\x14\x46\x69\x65\x6c\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x0e\x0a\x06\x6e\x75\x6d\x62\x65\x72\x18\x03\x20\x01\x28\x05\x12\x14\x0a\x05\x6c\x61\x62\x65\x6c\x18\x04\x20\x01\x28\x0b\x32\x05\x4c\x61\x62\x65\x6c\x12\x12\x0a\x04\x74\x79\x70\x65\x18\x05\x20\x01\x28\x0b\x32\x04\x54\x79\x70\x65\x12\x11\x0a\x09\x74\x79\x70\x65\x5f\x6e\x61\x6d\x65\x18\x06\x20\x01\x28\x09\x12\x10\x0a\x08\x65\x78\x74\x65\x6e\x64\x65\x65\x18\x02\x20\x01\x28\x09\x12\x15\x0a\x0d\x64\x65\x66\x61\x75\x6c\x74\x5f\x76\x61\x6c\x75\x65\x18\x07\x20\x01\x28\x09\x12\x13\x0a\x0b\x6f\x6e\x65\x6f\x66\x5f\x69\x6e\x64\x65\x78\x18\x09\x20\x01\x28\x05\x12\x11\x0a\x09\x6a\x73\x6f\x6e\x5f\x6e\x61\x6d\x65\x18\x0a\x20\x01\x28\x09\x12\x1d\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x08\x20\x01\x28\x0b\x32\x0c\x46\x69\x65\x6c\x64\x4f\x70\x74\x69\x6f\x6e\x73\x12\x17\x0a\x0f\x70\x72\x6f\x74\x6f\x33\x5f\x6f\x70\x74\x69\x6f\x6e\x61\x6c\x18\x11\x20\x01\x28\x08\x22\xb6\x02\x0a\x04\x54\x79\x70\x65\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x44\x4f\x55\x42\x4c\x45\x10\x01\x12\x0e\x0a\x0a\x54\x59\x50\x45\x5f\x46\x4c\x4f\x41\x54\x10\x02\x12\x0e\x0a\x0a\x54\x59\x50\x45\x5f\x49\x4e\x54\x36\x34\x10\x03\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x55\x49\x4e\x54\x36\x34\x10\x04\x12\x0e\x0a\x0a\x54\x59\x50\x45\x5f\x49\x4e\x54\x33\x32\x10\x05\x12\x10\x0a\x0c\x54\x59\x50\x45\x5f\x46\x49\x58\x45\x44\x36\x34\x10\x06\x12\x10\x0a\x0c\x54\x59\x50\x45\x5f\x46\x49\x58\x45\x44\x33\x32\x10\x07\x12\x0d\x0a\x09\x54\x59\x50\x45\x5f\x42\x4f\x4f\x4c\x10\x08\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x53\x54\x52\x49\x4e\x47\x10\x09\x12\x0e\x0a\x0a\x54\x59\x50\x45\x5f\x47\x52\x4f\x55\x50\x10\x0a\x12\x10\x0a\x0c\x54\x59\x50\x45\x5f\x4d\x45\x53\x53\x41\x47\x45\x10\x0b\x12\x0e\x0a\x0a\x54\x59\x50\x45\x5f\x42\x59\x54\x45\x53\x10\x0c\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x55\x49\x4e\x54\x33\x32\x10\x0d\x12\x0d\x0a\x09\x54\x59\x50\x45\x5f\x45\x4e\x55\x4d\x10\x0e\x12\x11\x0a\x0d\x54\x59\x50\x45\x5f\x53\x46\x49\x58\x45\x44\x33\x32\x10\x0f\x12\x11\x0a\x0d\x54\x59\x50\x45\x5f\x53\x46\x49\x58\x45\x44\x36\x34\x10\x10\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x53\x49\x4e\x54\x33\x32\x10\x11\x12\x0f\x0a\x0b\x54\x59\x50\x45\x5f\x53\x49\x4e\x54\x36\x34\x10\x12\x22\x43\x0a\x05\x4c\x61\x62\x65\x6c\x12\x12\x0a\x0e\x4c\x41\x42\x45\x4c\x5f\x4f\x50\x54\x49\x4f\x4e\x41\x4c\x10\x01\x12\x12\x0a\x0e\x4c\x41\x42\x45\x4c\x5f\x52\x45\x50\x45\x41\x54\x45\x44\x10\x03\x12\x12\x0a\x0e\x4c\x41\x42\x45\x4c\x5f\x52\x45\x51\x55\x49\x52\x45\x44\x10\x02\x22\x43\x0a\x14\x4f\x6e\x65\x6f\x66\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x1d\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x02\x20\x01\x28\x0b\x32\x0c\x4f\x6e\x65\x6f\x66\x4f\x70\x74\x69\x6f\x6e\x73\x22\xdd\x01\x0a\x13\x45\x6e\x75\x6d\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x27\x0a\x05\x76\x61\x6c\x75\x65\x18\x02\x20\x03\x28\x0b\x32\x18\x45\x6e\x75\x6d\x56\x61\x6c\x75\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x1c\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x03\x20\x01\x28\x0b\x32\x0b\x45\x6e\x75\x6d\x4f\x70\x74\x69\x6f\x6e\x73\x12\x29\x0a\x0e\x72\x65\x73\x65\x72\x76\x65\x64\x5f\x72\x61\x6e\x67\x65\x18\x04\x20\x03\x28\x0b\x32\x11\x45\x6e\x75\x6d\x52\x65\x73\x65\x72\x76\x65\x64\x52\x61\x6e\x67\x65\x12\x15\x0a\x0d\x72\x65\x73\x65\x72\x76\x65\x64\x5f\x6e\x61\x6d\x65\x18\x05\x20\x03\x28\x09\x1a\x2f\x0a\x11\x45\x6e\x75\x6d\x52\x65\x73\x65\x72\x76\x65\x64\x52\x61\x6e\x67\x65\x12\x0d\x0a\x05\x73\x74\x61\x72\x74\x18\x01\x20\x01\x28\x05\x12\x0b\x0a\x03\x65\x6e\x64\x18\x02\x20\x01\x28\x05\x22\x5b\x0a\x18\x45\x6e\x75\x6d\x56\x61\x6c\x75\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x0e\x0a\x06\x6e\x75\x6d\x62\x65\x72\x18\x02\x20\x01\x28\x05\x12\x21\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x03\x20\x01\x28\x0b\x32\x10\x45\x6e\x75\x6d\x56\x61\x6c\x75\x65\x4f\x70\x74\x69\x6f\x6e\x73\x22\x6e\x0a\x16\x53\x65\x72\x76\x69\x63\x65\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x25\x0a\x06\x6d\x65\x74\x68\x6f\x64\x18\x02\x20\x03\x28\x0b\x32\x15\x4d\x65\x74\x68\x6f\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x1f\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x03\x20\x01\x28\x0b\x32\x0e\x53\x65\x72\x76\x69\x63\x65\x4f\x70\x74\x69\x6f\x6e\x73\x22\xa2\x01\x0a\x15\x4d\x65\x74\x68\x6f\x64\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x50\x72\x6f\x74\x6f\x12\x0c\x0a\x04\x6e\x61\x6d\x65\x18\x01\x20\x01\x28\x09\x12\x12\x0a\x0a\x69\x6e\x70\x75\x74\x5f\x74\x79\x70\x65\x18\x02\x20\x01\x28\x09\x12\x13\x0a\x0b\x6f\x75\x74\x70\x75\x74\x5f\x74\x79\x70\x65\x18\x03\x20\x01\x28\x09\x12\x1e\x0a\x07\x6f\x70\x74\x69\x6f\x6e\x73\x18\x04\x20\x01\x28\x0b\x32\x0d\x4d\x65\x74\x68\x6f\x64\x4f\x70\x74\x69\x6f\x6e\x73\x12\x18\x0a\x10\x63\x6c\x69\x65\x6e\x74\x5f\x73\x74\x72\x65\x61\x6d\x69\x6e\x67\x18\x05\x20\x01\x28\x08\x12\x18\x0a\x10\x73\x65\x72\x76\x65\x72\x5f\x73\x74\x72\x65\x61\x6d\x69\x6e\x67\x18\x06\x20\x01\x28\x08\x22\xa4\x05\x0a\x0b\x46\x69\x6c\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x14\x0a\x0c\x6a\x61\x76\x61\x5f\x70\x61\x63\x6b\x61\x67\x65\x18\x01\x20\x01\x28\x09\x12\x1c\x0a\x14\x6a\x61\x76\x61\x5f\x6f\x75\x74\x65\x72\x5f\x63\x6c\x61\x73\x73\x6e\x61\x6d\x65\x18\x08\x20\x01\x28\x09\x12\x1b\x0a\x13\x6a\x61\x76\x61\x5f\x6d\x75\x6c\x74\x69\x70\x6c\x65\x5f\x66\x69\x6c\x65\x73\x18\x0a\x20\x01\x28\x08\x12\x25\x0a\x1d\x6a\x61\x76\x61\x5f\x67\x65\x6e\x65\x72\x61\x74\x65\x5f\x65\x71\x75\x61\x6c\x73\x5f\x61\x6e\x64\x5f\x68\x61\x73\x68\x18\x14\x20\x01\x28\x08\x12\x1e\x0a\x16\x6a\x61\x76\x61\x5f\x73\x74\x72\x69\x6e\x67\x5f\x63\x68\x65\x63\x6b\x5f\x75\x74\x66\x38\x18\x1b\x20\x01\x28\x08\x12\x22\x0a\x0c\x6f\x70\x74\x69\x6d\x69\x7a\x65\x5f\x66\x6f\x72\x18\x09\x20\x01\x28\x0b\x32\x0c\x4f\x70\x74\x69\x6d\x69\x7a\x65\x4d\x6f\x64\x65\x12\x12\x0a\x0a\x67\x6f\x5f\x70\x61\x63\x6b\x61\x67\x65\x18\x0b\x20\x01\x28\x09\x12\x1b\x0a\x13\x63\x63\x5f\x67\x65\x6e\x65\x72\x69\x63\x5f\x73\x65\x72\x76\x69\x63\x65\x73\x18\x10\x20\x01\x28\x08\x12\x1d\x0a\x15\x6a\x61\x76\x61\x5f\x67\x65\x6e\x65\x72\x69\x63\x5f\x73\x65\x72\x76\x69\x63\x65\x73\x18\x11\x20\x01\x28\x08\x12\x1b\x0a\x13\x70\x79\x5f\x67\x65\x6e\x65\x72\x69\x63\x5f\x73\x65\x72\x76\x69\x63\x65\x73\x18\x12\x20\x01\x28\x08\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x17\x20\x01\x28\x08\x12\x18\x0a\x10\x63\x63\x5f\x65\x6e\x61\x62\x6c\x65\x5f\x61\x72\x65\x6e\x61\x73\x18\x1f\x20\x01\x28\x08\x12\x19\x0a\x11\x6f\x62\x6a\x63\x5f\x63\x6c\x61\x73\x73\x5f\x70\x72\x65\x66\x69\x78\x18\x24\x20\x01\x28\x09\x12\x18\x0a\x10\x63\x73\x68\x61\x72\x70\x5f\x6e\x61\x6d\x65\x73\x70\x61\x63\x65\x18\x25\x20\x01\x28\x09\x12\x14\x0a\x0c\x73\x77\x69\x66\x74\x5f\x70\x72\x65\x66\x69\x78\x18\x27\x20\x01\x28\x09\x12\x18\x0a\x10\x70\x68\x70\x5f\x63\x6c\x61\x73\x73\x5f\x70\x72\x65\x66\x69\x78\x18\x28\x20\x01\x28\x09\x12\x15\x0a\x0d\x70\x68\x70\x5f\x6e\x61\x6d\x65\x73\x70\x61\x63\x65\x18\x29\x20\x01\x28\x09\x12\x1e\x0a\x16\x70\x68\x70\x5f\x6d\x65\x74\x61\x64\x61\x74\x61\x5f\x6e\x61\x6d\x65\x73\x70\x61\x63\x65\x18\x2c\x20\x01\x28\x09\x12\x14\x0a\x0c\x72\x75\x62\x79\x5f\x70\x61\x63\x6b\x61\x67\x65\x18\x2d\x20\x01\x28\x09\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x32\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\x3a\x0a\x0c\x4f\x70\x74\x69\x6d\x69\x7a\x65\x4d\x6f\x64\x65\x12\x09\x0a\x05\x53\x50\x45\x45\x44\x10\x01\x12\x0d\x0a\x09\x43\x4f\x44\x45\x5f\x53\x49\x5a\x45\x10\x02\x12\x10\x0a\x0c\x4c\x49\x54\x45\x5f\x52\x55\x4e\x54\x49\x4d\x45\x10\x03\x22\x83\x02\x0a\x0e\x4d\x65\x73\x73\x61\x67\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x1f\x0a\x17\x6d\x65\x73\x73\x61\x67\x65\x5f\x73\x65\x74\x5f\x77\x69\x72\x65\x5f\x66\x6f\x72\x6d\x61\x74\x18\x01\x20\x01\x28\x08\x12\x27\x0a\x1f\x6e\x6f\x5f\x73\x74\x61\x6e\x64\x61\x72\x64\x5f\x64\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x5f\x61\x63\x63\x65\x73\x73\x6f\x72\x18\x02\x20\x01\x28\x08\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x03\x20\x01\x28\x08\x12\x11\x0a\x09\x6d\x61\x70\x5f\x65\x6e\x74\x72\x79\x18\x07\x20\x01\x28\x08\x12\x2e\x0a\x26\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x5f\x6c\x65\x67\x61\x63\x79\x5f\x6a\x73\x6f\x6e\x5f\x66\x69\x65\x6c\x64\x5f\x63\x6f\x6e\x66\x6c\x69\x63\x74\x73\x18\x0b\x20\x01\x28\x08\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x0c\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\xbc\x08\x0a\x0c\x46\x69\x65\x6c\x64\x4f\x70\x74\x69\x6f\x6e\x73\x12\x14\x0a\x05\x63\x74\x79\x70\x65\x18\x01\x20\x01\x28\x0b\x32\x05\x43\x54\x79\x70\x65\x12\x0e\x0a\x06\x70\x61\x63\x6b\x65\x64\x18\x02\x20\x01\x28\x08\x12\x16\x0a\x06\x6a\x73\x74\x79\x70\x65\x18\x06\x20\x01\x28\x0b\x32\x06\x4a\x53\x54\x79\x70\x65\x12\x0c\x0a\x04\x6c\x61\x7a\x79\x18\x05\x20\x01\x28\x08\x12\x17\x0a\x0f\x75\x6e\x76\x65\x72\x69\x66\x69\x65\x64\x5f\x6c\x61\x7a\x79\x18\x0f\x20\x01\x28\x08\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x03\x20\x01\x28\x08\x12\x0c\x0a\x04\x77\x65\x61\x6b\x18\x0a\x20\x01\x28\x08\x12\x14\x0a\x0c\x64\x65\x62\x75\x67\x5f\x72\x65\x64\x61\x63\x74\x18\x10\x20\x01\x28\x08\x12\x22\x0a\x09\x72\x65\x74\x65\x6e\x74\x69\x6f\x6e\x18\x11\x20\x01\x28\x0b\x32\x0f\x4f\x70\x74\x69\x6f\x6e\x52\x65\x74\x65\x6e\x74\x69\x6f\x6e\x12\x21\x0a\x07\x74\x61\x72\x67\x65\x74\x73\x18\x13\x20\x03\x28\x0b\x32\x10\x4f\x70\x74\x69\x6f\x6e\x54\x61\x72\x67\x65\x74\x54\x79\x70\x65\x12\x28\x0a\x10\x65\x64\x69\x74\x69\x6f\x6e\x5f\x64\x65\x66\x61\x75\x6c\x74\x73\x18\x14\x20\x03\x28\x0b\x32\x0e\x45\x64\x69\x74\x69\x6f\x6e\x44\x65\x66\x61\x75\x6c\x74\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x15\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x27\x0a\x0f\x66\x65\x61\x74\x75\x72\x65\x5f\x73\x75\x70\x70\x6f\x72\x74\x18\x16\x20\x01\x28\x0b\x32\x0e\x46\x65\x61\x74\x75\x72\x65\x53\x75\x70\x70\x6f\x72\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x1a\x39\x0a\x0e\x45\x64\x69\x74\x69\x6f\x6e\x44\x65\x66\x61\x75\x6c\x74\x12\x18\x0a\x07\x65\x64\x69\x74\x69\x6f\x6e\x18\x03\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x0d\x0a\x05\x76\x61\x6c\x75\x65\x18\x02\x20\x01\x28\x09\x1a\x99\x01\x0a\x0e\x46\x65\x61\x74\x75\x72\x65\x53\x75\x70\x70\x6f\x72\x74\x12\x23\x0a\x12\x65\x64\x69\x74\x69\x6f\x6e\x5f\x69\x6e\x74\x72\x6f\x64\x75\x63\x65\x64\x18\x01\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x23\x0a\x12\x65\x64\x69\x74\x69\x6f\x6e\x5f\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x02\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x1b\x0a\x13\x64\x65\x70\x72\x65\x63\x61\x74\x69\x6f\x6e\x5f\x77\x61\x72\x6e\x69\x6e\x67\x18\x03\x20\x01\x28\x09\x12\x20\x0a\x0f\x65\x64\x69\x74\x69\x6f\x6e\x5f\x72\x65\x6d\x6f\x76\x65\x64\x18\x04\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x22\x2f\x0a\x05\x43\x54\x79\x70\x65\x12\x0a\x0a\x06\x53\x54\x52\x49\x4e\x47\x10\x00\x12\x08\x0a\x04\x43\x4f\x52\x44\x10\x01\x12\x10\x0a\x0c\x53\x54\x52\x49\x4e\x47\x5f\x50\x49\x45\x43\x45\x10\x02\x22\x35\x0a\x06\x4a\x53\x54\x79\x70\x65\x12\x0d\x0a\x09\x4a\x53\x5f\x4e\x4f\x52\x4d\x41\x4c\x10\x00\x12\x0d\x0a\x09\x4a\x53\x5f\x53\x54\x52\x49\x4e\x47\x10\x01\x12\x0d\x0a\x09\x4a\x53\x5f\x4e\x55\x4d\x42\x45\x52\x10\x02\x22\x55\x0a\x0f\x4f\x70\x74\x69\x6f\x6e\x52\x65\x74\x65\x6e\x74\x69\x6f\x6e\x12\x15\x0a\x11\x52\x45\x54\x45\x4e\x54\x49\x4f\x4e\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x15\x0a\x11\x52\x45\x54\x45\x4e\x54\x49\x4f\x4e\x5f\x52\x55\x4e\x54\x49\x4d\x45\x10\x01\x12\x14\x0a\x10\x52\x45\x54\x45\x4e\x54\x49\x4f\x4e\x5f\x53\x4f\x55\x52\x43\x45\x10\x02\x22\x8c\x02\x0a\x10\x4f\x70\x74\x69\x6f\x6e\x54\x61\x72\x67\x65\x74\x54\x79\x70\x65\x12\x17\x0a\x13\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x14\x0a\x10\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x46\x49\x4c\x45\x10\x01\x12\x1f\x0a\x1b\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x45\x58\x54\x45\x4e\x53\x49\x4f\x4e\x5f\x52\x41\x4e\x47\x45\x10\x02\x12\x17\x0a\x13\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x4d\x45\x53\x53\x41\x47\x45\x10\x03\x12\x15\x0a\x11\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x46\x49\x45\x4c\x44\x10\x04\x12\x15\x0a\x11\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x4f\x4e\x45\x4f\x46\x10\x05\x12\x14\x0a\x10\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x45\x4e\x55\x4d\x10\x06\x12\x1a\x0a\x16\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x45\x4e\x55\x4d\x5f\x45\x4e\x54\x52\x59\x10\x07\x12\x17\x0a\x13\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x53\x45\x52\x56\x49\x43\x45\x10\x08\x12\x16\x0a\x12\x54\x41\x52\x47\x45\x54\x5f\x54\x59\x50\x45\x5f\x4d\x45\x54\x48\x4f\x44\x10\x09\x22\x60\x0a\x0c\x4f\x6e\x65\x6f\x66\x4f\x70\x74\x69\x6f\x6e\x73\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x01\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\xb8\x01\x0a\x0b\x45\x6e\x75\x6d\x4f\x70\x74\x69\x6f\x6e\x73\x12\x13\x0a\x0b\x61\x6c\x6c\x6f\x77\x5f\x61\x6c\x69\x61\x73\x18\x02\x20\x01\x28\x08\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x03\x20\x01\x28\x08\x12\x2e\x0a\x26\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x5f\x6c\x65\x67\x61\x63\x79\x5f\x6a\x73\x6f\x6e\x5f\x66\x69\x65\x6c\x64\x5f\x63\x6f\x6e\x66\x6c\x69\x63\x74\x73\x18\x06\x20\x01\x28\x08\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x07\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\xc4\x01\x0a\x10\x45\x6e\x75\x6d\x56\x61\x6c\x75\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x01\x20\x01\x28\x08\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x02\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x14\x0a\x0c\x64\x65\x62\x75\x67\x5f\x72\x65\x64\x61\x63\x74\x18\x03\x20\x01\x28\x08\x12\x34\x0a\x0f\x66\x65\x61\x74\x75\x72\x65\x5f\x73\x75\x70\x70\x6f\x72\x74\x18\x04\x20\x01\x28\x0b\x32\x1b\x46\x69\x65\x6c\x64\x4f\x70\x74\x69\x6f\x6e\x73\x2e\x46\x65\x61\x74\x75\x72\x65\x53\x75\x70\x70\x6f\x72\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\x76\x0a\x0e\x53\x65\x72\x76\x69\x63\x65\x4f\x70\x74\x69\x6f\x6e\x73\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x22\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x21\x20\x01\x28\x08\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\xf4\x01\x0a\x0d\x4d\x65\x74\x68\x6f\x64\x4f\x70\x74\x69\x6f\x6e\x73\x12\x12\x0a\x0a\x64\x65\x70\x72\x65\x63\x61\x74\x65\x64\x18\x21\x20\x01\x28\x08\x12\x2b\x0a\x11\x69\x64\x65\x6d\x70\x6f\x74\x65\x6e\x63\x79\x5f\x6c\x65\x76\x65\x6c\x18\x22\x20\x01\x28\x0b\x32\x10\x49\x64\x65\x6d\x70\x6f\x74\x65\x6e\x63\x79\x4c\x65\x76\x65\x6c\x12\x1c\x0a\x08\x66\x65\x61\x74\x75\x72\x65\x73\x18\x23\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x32\x0a\x14\x75\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x5f\x6f\x70\x74\x69\x6f\x6e\x18\xe7\x07\x20\x03\x28\x0b\x32\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x22\x50\x0a\x10\x49\x64\x65\x6d\x70\x6f\x74\x65\x6e\x63\x79\x4c\x65\x76\x65\x6c\x12\x17\x0a\x13\x49\x44\x45\x4d\x50\x4f\x54\x45\x4e\x43\x59\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x13\x0a\x0f\x4e\x4f\x5f\x53\x49\x44\x45\x5f\x45\x46\x46\x45\x43\x54\x53\x10\x01\x12\x0e\x0a\x0a\x49\x44\x45\x4d\x50\x4f\x54\x45\x4e\x54\x10\x02\x22\xf9\x01\x0a\x13\x55\x6e\x69\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x64\x4f\x70\x74\x69\x6f\x6e\x12\x16\x0a\x04\x6e\x61\x6d\x65\x18\x02\x20\x03\x28\x0b\x32\x08\x4e\x61\x6d\x65\x50\x61\x72\x74\x12\x18\x0a\x10\x69\x64\x65\x6e\x74\x69\x66\x69\x65\x72\x5f\x76\x61\x6c\x75\x65\x18\x03\x20\x01\x28\x09\x12\x1a\x0a\x12\x70\x6f\x73\x69\x74\x69\x76\x65\x5f\x69\x6e\x74\x5f\x76\x61\x6c\x75\x65\x18\x04\x20\x01\x28\x04\x12\x1a\x0a\x12\x6e\x65\x67\x61\x74\x69\x76\x65\x5f\x69\x6e\x74\x5f\x76\x61\x6c\x75\x65\x18\x05\x20\x01\x28\x03\x12\x14\x0a\x0c\x64\x6f\x75\x62\x6c\x65\x5f\x76\x61\x6c\x75\x65\x18\x06\x20\x01\x28\x01\x12\x14\x0a\x0c\x73\x74\x72\x69\x6e\x67\x5f\x76\x61\x6c\x75\x65\x18\x07\x20\x01\x28\x0c\x12\x17\x0a\x0f\x61\x67\x67\x72\x65\x67\x61\x74\x65\x5f\x76\x61\x6c\x75\x65\x18\x08\x20\x01\x28\x09\x1a\x33\x0a\x08\x4e\x61\x6d\x65\x50\x61\x72\x74\x12\x11\x0a\x09\x6e\x61\x6d\x65\x5f\x70\x61\x72\x74\x18\x01\x20\x02\x28\x09\x12\x14\x0a\x0c\x69\x73\x5f\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x18\x02\x20\x02\x28\x08\x22\xd0\x05\x0a\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x25\x0a\x0e\x66\x69\x65\x6c\x64\x5f\x70\x72\x65\x73\x65\x6e\x63\x65\x18\x01\x20\x01\x28\x0b\x32\x0d\x46\x69\x65\x6c\x64\x50\x72\x65\x73\x65\x6e\x63\x65\x12\x1b\x0a\x09\x65\x6e\x75\x6d\x5f\x74\x79\x70\x65\x18\x02\x20\x01\x28\x0b\x32\x08\x45\x6e\x75\x6d\x54\x79\x70\x65\x12\x36\x0a\x17\x72\x65\x70\x65\x61\x74\x65\x64\x5f\x66\x69\x65\x6c\x64\x5f\x65\x6e\x63\x6f\x64\x69\x6e\x67\x18\x03\x20\x01\x28\x0b\x32\x15\x52\x65\x70\x65\x61\x74\x65\x64\x46\x69\x65\x6c\x64\x45\x6e\x63\x6f\x64\x69\x6e\x67\x12\x27\x0a\x0f\x75\x74\x66\x38\x5f\x76\x61\x6c\x69\x64\x61\x74\x69\x6f\x6e\x18\x04\x20\x01\x28\x0b\x32\x0e\x55\x74\x66\x38\x56\x61\x6c\x69\x64\x61\x74\x69\x6f\x6e\x12\x29\x0a\x10\x6d\x65\x73\x73\x61\x67\x65\x5f\x65\x6e\x63\x6f\x64\x69\x6e\x67\x18\x05\x20\x01\x28\x0b\x32\x0f\x4d\x65\x73\x73\x61\x67\x65\x45\x6e\x63\x6f\x64\x69\x6e\x67\x12\x1f\x0a\x0b\x6a\x73\x6f\x6e\x5f\x66\x6f\x72\x6d\x61\x74\x18\x06\x20\x01\x28\x0b\x32\x0a\x4a\x73\x6f\x6e\x46\x6f\x72\x6d\x61\x74\x22\x5c\x0a\x0d\x46\x69\x65\x6c\x64\x50\x72\x65\x73\x65\x6e\x63\x65\x12\x1a\x0a\x16\x46\x49\x45\x4c\x44\x5f\x50\x52\x45\x53\x45\x4e\x43\x45\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x0c\x0a\x08\x45\x58\x50\x4c\x49\x43\x49\x54\x10\x01\x12\x0c\x0a\x08\x49\x4d\x50\x4c\x49\x43\x49\x54\x10\x02\x12\x13\x0a\x0f\x4c\x45\x47\x41\x43\x59\x5f\x52\x45\x51\x55\x49\x52\x45\x44\x10\x03\x22\x37\x0a\x08\x45\x6e\x75\x6d\x54\x79\x70\x65\x12\x15\x0a\x11\x45\x4e\x55\x4d\x5f\x54\x59\x50\x45\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x08\x0a\x04\x4f\x50\x45\x4e\x10\x01\x12\x0a\x0a\x06\x43\x4c\x4f\x53\x45\x44\x10\x02\x22\x56\x0a\x15\x52\x65\x70\x65\x61\x74\x65\x64\x46\x69\x65\x6c\x64\x45\x6e\x63\x6f\x64\x69\x6e\x67\x12\x23\x0a\x1f\x52\x45\x50\x45\x41\x54\x45\x44\x5f\x46\x49\x45\x4c\x44\x5f\x45\x4e\x43\x4f\x44\x49\x4e\x47\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x0a\x0a\x06\x50\x41\x43\x4b\x45\x44\x10\x01\x12\x0c\x0a\x08\x45\x58\x50\x41\x4e\x44\x45\x44\x10\x02\x22\x43\x0a\x0e\x55\x74\x66\x38\x56\x61\x6c\x69\x64\x61\x74\x69\x6f\x6e\x12\x1b\x0a\x17\x55\x54\x46\x38\x5f\x56\x41\x4c\x49\x44\x41\x54\x49\x4f\x4e\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x0a\x0a\x06\x56\x45\x52\x49\x46\x59\x10\x02\x12\x08\x0a\x04\x4e\x4f\x4e\x45\x10\x03\x22\x53\x0a\x0f\x4d\x65\x73\x73\x61\x67\x65\x45\x6e\x63\x6f\x64\x69\x6e\x67\x12\x1c\x0a\x18\x4d\x45\x53\x53\x41\x47\x45\x5f\x45\x4e\x43\x4f\x44\x49\x4e\x47\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x13\x0a\x0f\x4c\x45\x4e\x47\x54\x48\x5f\x50\x52\x45\x46\x49\x58\x45\x44\x10\x01\x12\x0d\x0a\x09\x44\x45\x4c\x49\x4d\x49\x54\x45\x44\x10\x02\x22\x48\x0a\x0a\x4a\x73\x6f\x6e\x46\x6f\x72\x6d\x61\x74\x12\x17\x0a\x13\x4a\x53\x4f\x4e\x5f\x46\x4f\x52\x4d\x41\x54\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x09\x0a\x05\x41\x4c\x4c\x4f\x57\x10\x01\x12\x16\x0a\x12\x4c\x45\x47\x41\x43\x59\x5f\x42\x45\x53\x54\x5f\x45\x46\x46\x4f\x52\x54\x10\x02\x22\x89\x02\x0a\x12\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x44\x65\x66\x61\x75\x6c\x74\x73\x12\x2a\x0a\x08\x64\x65\x66\x61\x75\x6c\x74\x73\x18\x01\x20\x03\x28\x0b\x32\x18\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x45\x64\x69\x74\x69\x6f\x6e\x44\x65\x66\x61\x75\x6c\x74\x12\x20\x0a\x0f\x6d\x69\x6e\x69\x6d\x75\x6d\x5f\x65\x64\x69\x74\x69\x6f\x6e\x18\x04\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x20\x0a\x0f\x6d\x61\x78\x69\x6d\x75\x6d\x5f\x65\x64\x69\x74\x69\x6f\x6e\x18\x05\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x1a\x82\x01\x0a\x18\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x45\x64\x69\x74\x69\x6f\x6e\x44\x65\x66\x61\x75\x6c\x74\x12\x18\x0a\x07\x65\x64\x69\x74\x69\x6f\x6e\x18\x03\x20\x01\x28\x0b\x32\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x28\x0a\x14\x6f\x76\x65\x72\x72\x69\x64\x61\x62\x6c\x65\x5f\x66\x65\x61\x74\x75\x72\x65\x73\x18\x04\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x12\x22\x0a\x0e\x66\x69\x78\x65\x64\x5f\x66\x65\x61\x74\x75\x72\x65\x73\x18\x05\x20\x01\x28\x0b\x32\x0a\x46\x65\x61\x74\x75\x72\x65\x53\x65\x74\x22\xac\x01\x0a\x0e\x53\x6f\x75\x72\x63\x65\x43\x6f\x64\x65\x49\x6e\x66\x6f\x12\x1a\x0a\x08\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x18\x01\x20\x03\x28\x0b\x32\x08\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x1a\x7e\x0a\x08\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x12\x0c\x0a\x04\x70\x61\x74\x68\x18\x01\x20\x03\x28\x05\x12\x0c\x0a\x04\x73\x70\x61\x6e\x18\x02\x20\x03\x28\x05\x12\x18\x0a\x10\x6c\x65\x61\x64\x69\x6e\x67\x5f\x63\x6f\x6d\x6d\x65\x6e\x74\x73\x18\x03\x20\x01\x28\x09\x12\x19\x0a\x11\x74\x72\x61\x69\x6c\x69\x6e\x67\x5f\x63\x6f\x6d\x6d\x65\x6e\x74\x73\x18\x04\x20\x01\x28\x09\x12\x21\x0a\x19\x6c\x65\x61\x64\x69\x6e\x67\x5f\x64\x65\x74\x61\x63\x68\x65\x64\x5f\x63\x6f\x6d\x6d\x65\x6e\x74\x73\x18\x06\x20\x03\x28\x09\x22\xc7\x01\x0a\x11\x47\x65\x6e\x65\x72\x61\x74\x65\x64\x43\x6f\x64\x65\x49\x6e\x66\x6f\x12\x1e\x0a\x0a\x61\x6e\x6e\x6f\x74\x61\x74\x69\x6f\x6e\x18\x01\x20\x03\x28\x0b\x32\x0a\x41\x6e\x6e\x6f\x74\x61\x74\x69\x6f\x6e\x1a\x91\x01\x0a\x0a\x41\x6e\x6e\x6f\x74\x61\x74\x69\x6f\x6e\x12\x0c\x0a\x04\x70\x61\x74\x68\x18\x01\x20\x03\x28\x05\x12\x13\x0a\x0b\x73\x6f\x75\x72\x63\x65\x5f\x66\x69\x6c\x65\x18\x02\x20\x01\x28\x09\x12\x0d\x0a\x05\x62\x65\x67\x69\x6e\x18\x03\x20\x01\x28\x05\x12\x0b\x0a\x03\x65\x6e\x64\x18\x04\x20\x01\x28\x05\x12\x1a\x0a\x08\x73\x65\x6d\x61\x6e\x74\x69\x63\x18\x05\x20\x01\x28\x0b\x32\x08\x53\x65\x6d\x61\x6e\x74\x69\x63\x22\x28\x0a\x08\x53\x65\x6d\x61\x6e\x74\x69\x63\x12\x08\x0a\x04\x4e\x4f\x4e\x45\x10\x00\x12\x07\x0a\x03\x53\x45\x54\x10\x01\x12\x09\x0a\x05\x41\x4c\x49\x41\x53\x10\x02\x2a\xa7\x02\x0a\x07\x45\x64\x69\x74\x69\x6f\x6e\x12\x13\x0a\x0f\x45\x44\x49\x54\x49\x4f\x4e\x5f\x55\x4e\x4b\x4e\x4f\x57\x4e\x10\x00\x12\x13\x0a\x0e\x45\x44\x49\x54\x49\x4f\x4e\x5f\x4c\x45\x47\x41\x43\x59\x10\x84\x07\x12\x13\x0a\x0e\x45\x44\x49\x54\x49\x4f\x4e\x5f\x50\x52\x4f\x54\x4f\x32\x10\xe6\x07\x12\x13\x0a\x0e\x45\x44\x49\x54\x49\x4f\x4e\x5f\x50\x52\x4f\x54\x4f\x33\x10\xe7\x07\x12\x11\x0a\x0c\x45\x44\x49\x54\x49\x4f\x4e\x5f\x32\x30\x32\x33\x10\xe8\x07\x12\x11\x0a\x0c\x45\x44\x49\x54\x49\x4f\x4e\x5f\x32\x30\x32\x34\x10\xe9\x07\x12\x17\x0a\x13\x45\x44\x49\x54\x49\x4f\x4e\x5f\x31\x5f\x54\x45\x53\x54\x5f\x4f\x4e\x4c\x59\x10\x01\x12\x17\x0a\x13\x45\x44\x49\x54\x49\x4f\x4e\x5f\x32\x5f\x54\x45\x53\x54\x5f\x4f\x4e\x4c\x59\x10\x02\x12\x1d\x0a\x17\x45\x44\x49\x54\x49\x4f\x4e\x5f\x39\x39\x39\x39\x37\x5f\x54\x45\x53\x54\x5f\x4f\x4e\x4c\x59\x10\x9d\x8d\x06\x12\x1d\x0a\x17\x45\x44\x49\x54\x49\x4f\x4e\x5f\x39\x39\x39\x39\x38\x5f\x54\x45\x53\x54\x5f\x4f\x4e\x4c\x59\x10\x9e\x8d\x06\x12\x1d\x0a\x17\x45\x44\x49\x54\x49\x4f\x4e\x5f\x39\x39\x39\x39\x39\x5f\x54\x45\x53\x54\x5f\x4f\x4e\x4c\x59\x10\x9f\x8d\x06\x12\x13\x0a\x0b\x45\x44\x49\x54\x49\x4f\x4e\x5f\x4d\x41\x58\x10\xff\xff\xff\xff\x07\x62\x06\x70\x72\x6f\x74\x6f\x32"


-- | The protocol compiler can output a FileDescriptorSet containing the .proto
-- files it parses.
data FileDescriptorSet = FileDescriptorSet
  { fileDescriptorSetFile :: !(V.Vector FileDescriptorProto)
  , fileDescriptorSetUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultFileDescriptorSet :: FileDescriptorSet
defaultFileDescriptorSet = FileDescriptorSet
  { fileDescriptorSetFile = V.empty
  , fileDescriptorSetUnknownFields = []
  }

instance MessageEncode FileDescriptorSet where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 10 (buildSized v)) mempty msg.fileDescriptorSetFile
    <> encodeUnknownFieldsSized msg.fileDescriptorSetUnknownFields

instance MessageDecode FileDescriptorSet where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFileDescriptorSet emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v))
          (pure (case msg.fileDescriptorSetUnknownFields of { [] -> msg { fileDescriptorSetFile = growListToVector gl_0 }; _ -> msg { fileDescriptorSetFile = growListToVector gl_0, fileDescriptorSetUnknownFields = reverse (msg.fileDescriptorSetUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.fileDescriptorSetUnknownFields of { [] -> msg { fileDescriptorSetFile = growListToVector gl_0 }; _ -> msg { fileDescriptorSetFile = growListToVector gl_0, fileDescriptorSetUnknownFields = reverse (msg.fileDescriptorSetUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fileDescriptorSetUnknownFields = (uf : msg.fileDescriptorSetUnknownFields)}) gl_0)

-- | Field descriptors for 'FileDescriptorSet', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fileDescriptorSetFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FileDescriptorSet)
fileDescriptorSetFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "file"
        , fdNumber = 1
        , fdTypeDesc = MessageType "FileDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorSetFile
        , fdSet = \v m -> m { fileDescriptorSetFile = v }
        })
    ]

instance ProtoMessage FileDescriptorSet where
  protoMessageName _ = "google.protobuf.FileDescriptorSet"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFileDescriptorSet
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fileDescriptorSetFieldDescriptors

instance IsMessage FileDescriptorSet

instance Aeson.ToJSON FileDescriptorSet where
  toJSON msg = jsonObject
      [ "file" .=: msg.fileDescriptorSetFile

      ]

instance Aeson.FromJSON FileDescriptorSet where
  parseJSON = Aeson.withObject "FileDescriptorSet" $ \obj -> do
    fld_fileDescriptorSetFile <- parseFieldMaybe obj "file"
    pure defaultFileDescriptorSet
      { fileDescriptorSetFile = maybe (fileDescriptorSetFile defaultFileDescriptorSet) id fld_fileDescriptorSetFile
      }

instance Hashable FileDescriptorSet where
  hashWithSalt salt msg = V.foldl' hashWithSalt (salt) msg.fileDescriptorSetFile

instance Proto.Extension.HasExtensions FileDescriptorSet where
  messageUnknownFields = fileDescriptorSetUnknownFields
  setMessageUnknownFields !ufs msg = msg { fileDescriptorSetUnknownFields = ufs }

instance Semigroup FileDescriptorSet where
  a <> b = FileDescriptorSet
    { fileDescriptorSetFile = a.fileDescriptorSetFile <> b.fileDescriptorSetFile
    , fileDescriptorSetUnknownFields = a.fileDescriptorSetUnknownFields <> b.fileDescriptorSetUnknownFields
    }

instance Monoid FileDescriptorSet where
  mempty = defaultFileDescriptorSet

-- | The full set of known editions.
data Edition
  = Edition'EditionUnknown
    -- ^ A placeholder for an unknown edition value.
  | Edition'EditionLegacy
    -- ^ A placeholder edition for specifying default behaviors *before* a feature
    -- was first introduced.  This is effectively an "infinite past".
  | Edition'EditionProto2
    -- ^ Legacy syntax "editions".  These pre-date editions, but behave much like
    -- distinct editions.  These can't be used to specify the edition of proto
    -- files, but feature definitions must supply proto2/proto3 defaults for
    -- backwards compatibility.
  | Edition'EditionProto3
  | Edition'Edition2023
    -- ^ Editions that have been released.  The specific values are arbitrary and
    -- should not be depended on, but they will always be time-ordered for easy
    -- comparison.
  | Edition'Edition2024
  | Edition'Edition1TestOnly
    -- ^ Placeholder editions for testing feature resolution.  These should not be
    -- used or relyed on outside of tests.
  | Edition'Edition2TestOnly
  | Edition'Edition99997TestOnly
  | Edition'Edition99998TestOnly
  | Edition'Edition99999TestOnly
  | Edition'EditionMax
    -- ^ Placeholder for specifying unbounded edition support.  This should only
    -- ever be used by plugins that can expect to never require any changes to
    -- support a new edition.
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumEdition :: Edition -> Int
toProtoEnumEdition Edition'EditionUnknown = 0
toProtoEnumEdition Edition'EditionLegacy = 900
toProtoEnumEdition Edition'EditionProto2 = 998
toProtoEnumEdition Edition'EditionProto3 = 999
toProtoEnumEdition Edition'Edition2023 = 1000
toProtoEnumEdition Edition'Edition2024 = 1001
toProtoEnumEdition Edition'Edition1TestOnly = 1
toProtoEnumEdition Edition'Edition2TestOnly = 2
toProtoEnumEdition Edition'Edition99997TestOnly = 99997
toProtoEnumEdition Edition'Edition99998TestOnly = 99998
toProtoEnumEdition Edition'Edition99999TestOnly = 99999
toProtoEnumEdition Edition'EditionMax = 2147483647

fromProtoEnumEdition :: Int -> Maybe Edition
fromProtoEnumEdition 0 = Just Edition'EditionUnknown
fromProtoEnumEdition 900 = Just Edition'EditionLegacy
fromProtoEnumEdition 998 = Just Edition'EditionProto2
fromProtoEnumEdition 999 = Just Edition'EditionProto3
fromProtoEnumEdition 1000 = Just Edition'Edition2023
fromProtoEnumEdition 1001 = Just Edition'Edition2024
fromProtoEnumEdition 1 = Just Edition'Edition1TestOnly
fromProtoEnumEdition 2 = Just Edition'Edition2TestOnly
fromProtoEnumEdition 99997 = Just Edition'Edition99997TestOnly
fromProtoEnumEdition 99998 = Just Edition'Edition99998TestOnly
fromProtoEnumEdition 99999 = Just Edition'Edition99999TestOnly
fromProtoEnumEdition 2147483647 = Just Edition'EditionMax
fromProtoEnumEdition _ = Nothing

instance MessageEncode Edition where
  buildSized _ = mempty
instance MessageDecode Edition where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON Edition where
  toJSON Edition'EditionUnknown = Aeson.String "EDITION_UNKNOWN"
  toJSON Edition'EditionLegacy = Aeson.String "EDITION_LEGACY"
  toJSON Edition'EditionProto2 = Aeson.String "EDITION_PROTO2"
  toJSON Edition'EditionProto3 = Aeson.String "EDITION_PROTO3"
  toJSON Edition'Edition2023 = Aeson.String "EDITION_2023"
  toJSON Edition'Edition2024 = Aeson.String "EDITION_2024"
  toJSON Edition'Edition1TestOnly = Aeson.String "EDITION_1_TEST_ONLY"
  toJSON Edition'Edition2TestOnly = Aeson.String "EDITION_2_TEST_ONLY"
  toJSON Edition'Edition99997TestOnly = Aeson.String "EDITION_99997_TEST_ONLY"
  toJSON Edition'Edition99998TestOnly = Aeson.String "EDITION_99998_TEST_ONLY"
  toJSON Edition'Edition99999TestOnly = Aeson.String "EDITION_99999_TEST_ONLY"
  toJSON Edition'EditionMax = Aeson.String "EDITION_MAX"

instance Aeson.FromJSON Edition where
  parseJSON = \case
    Aeson.String "EDITION_UNKNOWN" -> pure Edition'EditionUnknown
    Aeson.String "EDITION_LEGACY" -> pure Edition'EditionLegacy
    Aeson.String "EDITION_PROTO2" -> pure Edition'EditionProto2
    Aeson.String "EDITION_PROTO3" -> pure Edition'EditionProto3
    Aeson.String "EDITION_2023" -> pure Edition'Edition2023
    Aeson.String "EDITION_2024" -> pure Edition'Edition2024
    Aeson.String "EDITION_1_TEST_ONLY" -> pure Edition'Edition1TestOnly
    Aeson.String "EDITION_2_TEST_ONLY" -> pure Edition'Edition2TestOnly
    Aeson.String "EDITION_99997_TEST_ONLY" -> pure Edition'Edition99997TestOnly
    Aeson.String "EDITION_99998_TEST_ONLY" -> pure Edition'Edition99998TestOnly
    Aeson.String "EDITION_99999_TEST_ONLY" -> pure Edition'Edition99999TestOnly
    Aeson.String "EDITION_MAX" -> pure Edition'EditionMax
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for Edition"

instance Hashable Edition where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumEdition x)

-- | Describes a complete .proto file.
data FileDescriptorProto = FileDescriptorProto
  { fileDescriptorProtoName :: !(Maybe Text)
  , fileDescriptorProtoPackage :: !(Maybe Text)
  , fileDescriptorProtoDependency :: !(V.Vector Text)
    -- ^ Names of files imported by this file.
  , fileDescriptorProtoPublicDependency :: !(VU.Vector Int32)
    -- ^ Indexes of the public imported files in the dependency list above.
  , fileDescriptorProtoWeakDependency :: !(VU.Vector Int32)
    -- ^ Indexes of the weak imported files in the dependency list.
    -- For Google-internal migration only. Do not use.
  , fileDescriptorProtoMessageType :: !(V.Vector DescriptorProto)
    -- ^ All top-level definitions in this file.
  , fileDescriptorProtoEnumType :: !(V.Vector EnumDescriptorProto)
  , fileDescriptorProtoService :: !(V.Vector ServiceDescriptorProto)
  , fileDescriptorProtoExtension :: !(V.Vector FieldDescriptorProto)
  , fileDescriptorProtoOptions :: !(Maybe FileOptions)
  , fileDescriptorProtoSourceCodeInfo :: !(Maybe SourceCodeInfo)
    -- ^ This field contains optional information about the original source code.
    -- You may safely remove this entire field without harming runtime
    -- functionality of the descriptors -- the information is needed only by
    -- development tools.
  , fileDescriptorProtoSyntax :: !(Maybe Text)
    -- ^ The syntax of the proto file.
    -- The supported values are "proto2", "proto3", and "editions".
    -- 
    -- If `edition` is present, this value must be "editions".
  , fileDescriptorProtoEdition :: !(Maybe Edition)
    -- ^ The edition of the proto file.
  , fileDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultFileDescriptorProto :: FileDescriptorProto
defaultFileDescriptorProto = FileDescriptorProto
  { fileDescriptorProtoName = Nothing
  , fileDescriptorProtoPackage = Nothing
  , fileDescriptorProtoDependency = V.empty
  , fileDescriptorProtoPublicDependency = VU.empty
  , fileDescriptorProtoWeakDependency = VU.empty
  , fileDescriptorProtoMessageType = V.empty
  , fileDescriptorProtoEnumType = V.empty
  , fileDescriptorProtoService = V.empty
  , fileDescriptorProtoExtension = V.empty
  , fileDescriptorProtoOptions = Nothing
  , fileDescriptorProtoSourceCodeInfo = Nothing
  , fileDescriptorProtoSyntax = Nothing
  , fileDescriptorProtoEdition = Nothing
  , fileDescriptorProtoUnknownFields = []
  }

instance MessageEncode FileDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.fileDescriptorProtoName)
    <> (maybe mempty (\v -> archString 18 v) msg.fileDescriptorProtoPackage)
    <> V.foldl' (\acc v -> acc <> archString 26 v) mempty msg.fileDescriptorProtoDependency
    <> encodePackedInt32 10 msg.fileDescriptorProtoPublicDependency
    <> encodePackedInt32 11 msg.fileDescriptorProtoWeakDependency
    <> V.foldl' (\acc v -> acc <> archSubmessage 34 (buildSized v)) mempty msg.fileDescriptorProtoMessageType
    <> V.foldl' (\acc v -> acc <> archSubmessage 42 (buildSized v)) mempty msg.fileDescriptorProtoEnumType
    <> V.foldl' (\acc v -> acc <> archSubmessage 50 (buildSized v)) mempty msg.fileDescriptorProtoService
    <> V.foldl' (\acc v -> acc <> archSubmessage 58 (buildSized v)) mempty msg.fileDescriptorProtoExtension
    <> (maybe mempty (\v -> archSubmessage 66 (buildSized v)) msg.fileDescriptorProtoOptions)
    <> (maybe mempty (\v -> archSubmessage 74 (buildSized v)) msg.fileDescriptorProtoSourceCodeInfo)
    <> (maybe mempty (\v -> archString 98 v) msg.fileDescriptorProtoSyntax)
    <> (maybe mempty (\v -> archVarint 112 (fromIntegral (toProtoEnumEdition v))) msg.fileDescriptorProtoEdition)
    <> encodeUnknownFieldsSized msg.fileDescriptorProtoUnknownFields

instance MessageDecode FileDescriptorProto where
  messageDecoder = stage_0 defaultFileDescriptorProto emptyGrowList emptyGrowList emptyGrowList emptyGrowList emptyGrowList
    where
      stage_0 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { fileDescriptorProtoName = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_1 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { fileDescriptorProtoPackage = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_2 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 msg (snocGrowList gl_0 v) gl_1 gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_3 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x52 :: Data.Word.Word8)
          (VU.map fromIntegral <$> decodePackedVarint)
          (\v -> stage_4 (msg { fileDescriptorProtoPublicDependency = v}) gl_0 gl_1 gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_4 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x5a :: Data.Word.Word8)
          (VU.map fromIntegral <$> decodePackedVarint)
          (\v -> stage_5 (msg { fileDescriptorProtoWeakDependency = v}) gl_0 gl_1 gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_5 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_5 msg gl_0 (snocGrowList gl_1 v) gl_2 gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_6 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x2a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_6 msg gl_0 gl_1 (snocGrowList gl_2 v) gl_3 gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      stage_7 msg gl_0 gl_1 gl_2 gl_3 gl_4 =
        inOrderStage1
          (0x32 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_7 msg gl_0 gl_1 gl_2 (snocGrowList gl_3 v) gl_4)
          (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4)
      loop msg gl_0 gl_1 gl_2 gl_3 gl_4 = withTagM
        (pure (case msg.fileDescriptorProtoUnknownFields of { [] -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4 }; _ -> msg { fileDescriptorProtoDependency = growListToVector gl_0, fileDescriptorProtoMessageType = growListToVector gl_1, fileDescriptorProtoEnumType = growListToVector gl_2, fileDescriptorProtoService = growListToVector gl_3, fileDescriptorProtoExtension = growListToVector gl_4, fileDescriptorProtoUnknownFields = reverse (msg.fileDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { fileDescriptorProtoName = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          2 -> do
            v <- decodeFieldString
            loop (msg { fileDescriptorProtoPackage = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          3 -> do
            v <- decodeFieldString
            loop msg (snocGrowList gl_0 v) gl_1 gl_2 gl_3 gl_4
          10 -> case wt of
            2 -> do
              vs <- (VU.map fromIntegral <$> decodePackedVarint)
              loop (msg { fileDescriptorProtoPublicDependency = (msg.fileDescriptorProtoPublicDependency <> vs)}) gl_0 gl_1 gl_2 gl_3 gl_4
            _ -> do
              v <- (fromIntegral <$> decodeFieldVarint)
              loop (msg { fileDescriptorProtoPublicDependency = (VU.snoc msg.fileDescriptorProtoPublicDependency v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          11 -> case wt of
            2 -> do
              vs <- (VU.map fromIntegral <$> decodePackedVarint)
              loop (msg { fileDescriptorProtoWeakDependency = (msg.fileDescriptorProtoWeakDependency <> vs)}) gl_0 gl_1 gl_2 gl_3 gl_4
            _ -> do
              v <- (fromIntegral <$> decodeFieldVarint)
              loop (msg { fileDescriptorProtoWeakDependency = (VU.snoc msg.fileDescriptorProtoWeakDependency v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          4 -> do
            v <- decodeFieldMessage
            loop msg gl_0 (snocGrowList gl_1 v) gl_2 gl_3 gl_4
          5 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 (snocGrowList gl_2 v) gl_3 gl_4
          6 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 (snocGrowList gl_3 v) gl_4
          7 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 gl_3 (snocGrowList gl_4 v)
          8 -> do
            v <- decodeFieldMessage
            loop (msg { fileDescriptorProtoOptions = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          9 -> do
            v <- decodeFieldMessage
            loop (msg { fileDescriptorProtoSourceCodeInfo = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          12 -> do
            v <- decodeFieldString
            loop (msg { fileDescriptorProtoSyntax = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          14 -> do
            v <- decodeFieldEnum
            loop (msg { fileDescriptorProtoEdition = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fileDescriptorProtoUnknownFields = (uf : msg.fileDescriptorProtoUnknownFields)}) gl_0 gl_1 gl_2 gl_3 gl_4)

-- | Field descriptors for 'FileDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fileDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FileDescriptorProto)
fileDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoName
        , fdSet = \v m -> m { fileDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "package"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoPackage
        , fdSet = \v m -> m { fileDescriptorProtoPackage = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "dependency"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoDependency
        , fdSet = \v m -> m { fileDescriptorProtoDependency = v }
        })
    , (10, SomeField FieldDescriptor
        { fdName = "public_dependency"
        , fdNumber = 10
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoPublicDependency
        , fdSet = \v m -> m { fileDescriptorProtoPublicDependency = v }
        })
    , (11, SomeField FieldDescriptor
        { fdName = "weak_dependency"
        , fdNumber = 11
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoWeakDependency
        , fdSet = \v m -> m { fileDescriptorProtoWeakDependency = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "message_type"
        , fdNumber = 4
        , fdTypeDesc = MessageType "DescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoMessageType
        , fdSet = \v m -> m { fileDescriptorProtoMessageType = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "enum_type"
        , fdNumber = 5
        , fdTypeDesc = MessageType "EnumDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoEnumType
        , fdSet = \v m -> m { fileDescriptorProtoEnumType = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "service"
        , fdNumber = 6
        , fdTypeDesc = MessageType "ServiceDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoService
        , fdSet = \v m -> m { fileDescriptorProtoService = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "extension"
        , fdNumber = 7
        , fdTypeDesc = MessageType "FieldDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = fileDescriptorProtoExtension
        , fdSet = \v m -> m { fileDescriptorProtoExtension = v }
        })
    , (8, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 8
        , fdTypeDesc = MessageType "FileOptions"
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoOptions
        , fdSet = \v m -> m { fileDescriptorProtoOptions = v }
        })
    , (9, SomeField FieldDescriptor
        { fdName = "source_code_info"
        , fdNumber = 9
        , fdTypeDesc = MessageType "SourceCodeInfo"
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoSourceCodeInfo
        , fdSet = \v m -> m { fileDescriptorProtoSourceCodeInfo = v }
        })
    , (12, SomeField FieldDescriptor
        { fdName = "syntax"
        , fdNumber = 12
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoSyntax
        , fdSet = \v m -> m { fileDescriptorProtoSyntax = v }
        })
    , (14, SomeField FieldDescriptor
        { fdName = "edition"
        , fdNumber = 14
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = fileDescriptorProtoEdition
        , fdSet = \v m -> m { fileDescriptorProtoEdition = v }
        })
    ]

instance ProtoMessage FileDescriptorProto where
  protoMessageName _ = "google.protobuf.FileDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFileDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fileDescriptorProtoFieldDescriptors

instance IsMessage FileDescriptorProto

instance Aeson.ToJSON FileDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.fileDescriptorProtoName
      , "package" .=: msg.fileDescriptorProtoPackage
      , "dependency" .=: msg.fileDescriptorProtoDependency
      , "publicDependency" .=: msg.fileDescriptorProtoPublicDependency
      , "weakDependency" .=: msg.fileDescriptorProtoWeakDependency
      , "messageType" .=: msg.fileDescriptorProtoMessageType
      , "enumType" .=: msg.fileDescriptorProtoEnumType
      , "service" .=: msg.fileDescriptorProtoService
      , "extension" .=: msg.fileDescriptorProtoExtension
      , "options" .=: msg.fileDescriptorProtoOptions
      , "sourceCodeInfo" .=: msg.fileDescriptorProtoSourceCodeInfo
      , "syntax" .=: msg.fileDescriptorProtoSyntax
      , "edition" .=: msg.fileDescriptorProtoEdition
      ]

instance Aeson.FromJSON FileDescriptorProto where
  parseJSON = Aeson.withObject "FileDescriptorProto" $ \obj -> do
    fld_fileDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_fileDescriptorProtoPackage <- parseFieldMaybe obj "package"
    fld_fileDescriptorProtoDependency <- parseFieldMaybe obj "dependency"
    fld_fileDescriptorProtoPublicDependency <- parseFieldMaybe obj "publicDependency"
    fld_fileDescriptorProtoWeakDependency <- parseFieldMaybe obj "weakDependency"
    fld_fileDescriptorProtoMessageType <- parseFieldMaybe obj "messageType"
    fld_fileDescriptorProtoEnumType <- parseFieldMaybe obj "enumType"
    fld_fileDescriptorProtoService <- parseFieldMaybe obj "service"
    fld_fileDescriptorProtoExtension <- parseFieldMaybe obj "extension"
    fld_fileDescriptorProtoOptions <- parseFieldMaybe obj "options"
    fld_fileDescriptorProtoSourceCodeInfo <- parseFieldMaybe obj "sourceCodeInfo"
    fld_fileDescriptorProtoSyntax <- parseFieldMaybe obj "syntax"
    fld_fileDescriptorProtoEdition <- parseFieldMaybe obj "edition"
    pure defaultFileDescriptorProto
      { fileDescriptorProtoName = maybe (fileDescriptorProtoName defaultFileDescriptorProto) id fld_fileDescriptorProtoName
      , fileDescriptorProtoPackage = maybe (fileDescriptorProtoPackage defaultFileDescriptorProto) id fld_fileDescriptorProtoPackage
      , fileDescriptorProtoDependency = maybe (fileDescriptorProtoDependency defaultFileDescriptorProto) id fld_fileDescriptorProtoDependency
      , fileDescriptorProtoPublicDependency = maybe (fileDescriptorProtoPublicDependency defaultFileDescriptorProto) id fld_fileDescriptorProtoPublicDependency
      , fileDescriptorProtoWeakDependency = maybe (fileDescriptorProtoWeakDependency defaultFileDescriptorProto) id fld_fileDescriptorProtoWeakDependency
      , fileDescriptorProtoMessageType = maybe (fileDescriptorProtoMessageType defaultFileDescriptorProto) id fld_fileDescriptorProtoMessageType
      , fileDescriptorProtoEnumType = maybe (fileDescriptorProtoEnumType defaultFileDescriptorProto) id fld_fileDescriptorProtoEnumType
      , fileDescriptorProtoService = maybe (fileDescriptorProtoService defaultFileDescriptorProto) id fld_fileDescriptorProtoService
      , fileDescriptorProtoExtension = maybe (fileDescriptorProtoExtension defaultFileDescriptorProto) id fld_fileDescriptorProtoExtension
      , fileDescriptorProtoOptions = maybe (fileDescriptorProtoOptions defaultFileDescriptorProto) id fld_fileDescriptorProtoOptions
      , fileDescriptorProtoSourceCodeInfo = maybe (fileDescriptorProtoSourceCodeInfo defaultFileDescriptorProto) id fld_fileDescriptorProtoSourceCodeInfo
      , fileDescriptorProtoSyntax = maybe (fileDescriptorProtoSyntax defaultFileDescriptorProto) id fld_fileDescriptorProtoSyntax
      , fileDescriptorProtoEdition = maybe (fileDescriptorProtoEdition defaultFileDescriptorProto) id fld_fileDescriptorProtoEdition
      }

instance Hashable FileDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (VU.foldl' hashWithSalt (VU.foldl' hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.fileDescriptorProtoName) msg.fileDescriptorProtoPackage) msg.fileDescriptorProtoDependency) msg.fileDescriptorProtoPublicDependency) msg.fileDescriptorProtoWeakDependency) msg.fileDescriptorProtoMessageType) msg.fileDescriptorProtoEnumType) msg.fileDescriptorProtoService) msg.fileDescriptorProtoExtension) msg.fileDescriptorProtoOptions) msg.fileDescriptorProtoSourceCodeInfo) msg.fileDescriptorProtoSyntax) msg.fileDescriptorProtoEdition

instance Proto.Extension.HasExtensions FileDescriptorProto where
  messageUnknownFields = fileDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { fileDescriptorProtoUnknownFields = ufs }

instance Semigroup FileDescriptorProto where
  a <> b = FileDescriptorProto
    { fileDescriptorProtoName = case b.fileDescriptorProtoName of { Nothing -> a.fileDescriptorProtoName; x -> x }
    , fileDescriptorProtoPackage = case b.fileDescriptorProtoPackage of { Nothing -> a.fileDescriptorProtoPackage; x -> x }
    , fileDescriptorProtoDependency = a.fileDescriptorProtoDependency <> b.fileDescriptorProtoDependency
    , fileDescriptorProtoPublicDependency = a.fileDescriptorProtoPublicDependency <> b.fileDescriptorProtoPublicDependency
    , fileDescriptorProtoWeakDependency = a.fileDescriptorProtoWeakDependency <> b.fileDescriptorProtoWeakDependency
    , fileDescriptorProtoMessageType = a.fileDescriptorProtoMessageType <> b.fileDescriptorProtoMessageType
    , fileDescriptorProtoEnumType = a.fileDescriptorProtoEnumType <> b.fileDescriptorProtoEnumType
    , fileDescriptorProtoService = a.fileDescriptorProtoService <> b.fileDescriptorProtoService
    , fileDescriptorProtoExtension = a.fileDescriptorProtoExtension <> b.fileDescriptorProtoExtension
    , fileDescriptorProtoOptions = case b.fileDescriptorProtoOptions of { Nothing -> a.fileDescriptorProtoOptions; x -> x }
    , fileDescriptorProtoSourceCodeInfo = case b.fileDescriptorProtoSourceCodeInfo of { Nothing -> a.fileDescriptorProtoSourceCodeInfo; x -> x }
    , fileDescriptorProtoSyntax = case b.fileDescriptorProtoSyntax of { Nothing -> a.fileDescriptorProtoSyntax; x -> x }
    , fileDescriptorProtoEdition = case b.fileDescriptorProtoEdition of { Nothing -> a.fileDescriptorProtoEdition; x -> x }
    , fileDescriptorProtoUnknownFields = a.fileDescriptorProtoUnknownFields <> b.fileDescriptorProtoUnknownFields
    }

instance Monoid FileDescriptorProto where
  mempty = defaultFileDescriptorProto

-- | Describes a message type.
data DescriptorProto = DescriptorProto
  { descriptorProtoName :: !(Maybe Text)
  , descriptorProtoField :: !(V.Vector FieldDescriptorProto)
  , descriptorProtoExtension :: !(V.Vector FieldDescriptorProto)
  , descriptorProtoNestedType :: !(V.Vector DescriptorProto)
  , descriptorProtoEnumType :: !(V.Vector EnumDescriptorProto)
  , descriptorProtoExtensionRange :: !(V.Vector DescriptorProto'ExtensionRange)
  , descriptorProtoOneofDecl :: !(V.Vector OneofDescriptorProto)
  , descriptorProtoOptions :: !(Maybe MessageOptions)
  , descriptorProtoReservedRange :: !(V.Vector DescriptorProto'ReservedRange)
  , descriptorProtoReservedName :: !(V.Vector Text)
    -- ^ Reserved field names, which may not be used by fields in the same message.
    -- A given name may only be reserved once.
  , descriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data DescriptorProto'ExtensionRange = DescriptorProto'ExtensionRange
  { descriptorProtoExtensionRangeStart :: !(Maybe Int32)
  , descriptorProtoExtensionRangeEnd :: !(Maybe Int32)
  , descriptorProtoExtensionRangeOptions :: !(Maybe ExtensionRangeOptions)
  , descriptorProtoExtensionRangeUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultDescriptorProto'ExtensionRange :: DescriptorProto'ExtensionRange
defaultDescriptorProto'ExtensionRange = DescriptorProto'ExtensionRange
  { descriptorProtoExtensionRangeStart = Nothing
  , descriptorProtoExtensionRangeEnd = Nothing
  , descriptorProtoExtensionRangeOptions = Nothing
  , descriptorProtoExtensionRangeUnknownFields = []
  }

instance MessageEncode DescriptorProto'ExtensionRange where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral v)) msg.descriptorProtoExtensionRangeStart)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral v)) msg.descriptorProtoExtensionRangeEnd)
    <> (maybe mempty (\v -> archSubmessage 26 (buildSized v)) msg.descriptorProtoExtensionRangeOptions)
    <> encodeUnknownFieldsSized msg.descriptorProtoExtensionRangeUnknownFields

instance MessageDecode DescriptorProto'ExtensionRange where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultDescriptorProto'ExtensionRange
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_1 (msg { descriptorProtoExtensionRangeStart = (Just v)}))
          (pure (case msg.descriptorProtoExtensionRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoExtensionRangeUnknownFields = reverse (msg.descriptorProtoExtensionRangeUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_2 (msg { descriptorProtoExtensionRangeEnd = (Just v)}))
          (pure (case msg.descriptorProtoExtensionRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoExtensionRangeUnknownFields = reverse (msg.descriptorProtoExtensionRangeUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { descriptorProtoExtensionRangeOptions = (Just v)}))
          (pure (case msg.descriptorProtoExtensionRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoExtensionRangeUnknownFields = reverse (msg.descriptorProtoExtensionRangeUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.descriptorProtoExtensionRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoExtensionRangeUnknownFields = reverse (msg.descriptorProtoExtensionRangeUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { descriptorProtoExtensionRangeStart = (Just v)})
          2 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { descriptorProtoExtensionRangeEnd = (Just v)})
          3 -> do
            v <- decodeFieldMessage
            loop (msg { descriptorProtoExtensionRangeOptions = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { descriptorProtoExtensionRangeUnknownFields = (uf : msg.descriptorProtoExtensionRangeUnknownFields)}))

-- | Field descriptors for 'DescriptorProto'ExtensionRange', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
descriptorProto'ExtensionRangeFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor DescriptorProto'ExtensionRange)
descriptorProto'ExtensionRangeFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "start"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoExtensionRangeStart
        , fdSet = \v m -> m { descriptorProtoExtensionRangeStart = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "end"
        , fdNumber = 2
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoExtensionRangeEnd
        , fdSet = \v m -> m { descriptorProtoExtensionRangeEnd = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 3
        , fdTypeDesc = MessageType "ExtensionRangeOptions"
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoExtensionRangeOptions
        , fdSet = \v m -> m { descriptorProtoExtensionRangeOptions = v }
        })
    ]

instance ProtoMessage DescriptorProto'ExtensionRange where
  protoMessageName _ = "google.protobuf.DescriptorProto.ExtensionRange"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultDescriptorProto'ExtensionRange
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = descriptorProto'ExtensionRangeFieldDescriptors

instance IsMessage DescriptorProto'ExtensionRange

instance Aeson.ToJSON DescriptorProto'ExtensionRange where
  toJSON msg = jsonObject
      [ "start" .=: msg.descriptorProtoExtensionRangeStart
      , "end" .=: msg.descriptorProtoExtensionRangeEnd
      , "options" .=: msg.descriptorProtoExtensionRangeOptions
      ]

instance Aeson.FromJSON DescriptorProto'ExtensionRange where
  parseJSON = Aeson.withObject "DescriptorProto'ExtensionRange" $ \obj -> do
    fld_descriptorProtoExtensionRangeStart <- parseFieldMaybe obj "start"
    fld_descriptorProtoExtensionRangeEnd <- parseFieldMaybe obj "end"
    fld_descriptorProtoExtensionRangeOptions <- parseFieldMaybe obj "options"
    pure defaultDescriptorProto'ExtensionRange
      { descriptorProtoExtensionRangeStart = maybe (descriptorProtoExtensionRangeStart defaultDescriptorProto'ExtensionRange) id fld_descriptorProtoExtensionRangeStart
      , descriptorProtoExtensionRangeEnd = maybe (descriptorProtoExtensionRangeEnd defaultDescriptorProto'ExtensionRange) id fld_descriptorProtoExtensionRangeEnd
      , descriptorProtoExtensionRangeOptions = maybe (descriptorProtoExtensionRangeOptions defaultDescriptorProto'ExtensionRange) id fld_descriptorProtoExtensionRangeOptions
      }

instance Hashable DescriptorProto'ExtensionRange where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.descriptorProtoExtensionRangeStart) msg.descriptorProtoExtensionRangeEnd) msg.descriptorProtoExtensionRangeOptions

instance Proto.Extension.HasExtensions DescriptorProto'ExtensionRange where
  messageUnknownFields = descriptorProtoExtensionRangeUnknownFields
  setMessageUnknownFields !ufs msg = msg { descriptorProtoExtensionRangeUnknownFields = ufs }

instance Semigroup DescriptorProto'ExtensionRange where
  a <> b = DescriptorProto'ExtensionRange
    { descriptorProtoExtensionRangeStart = case b.descriptorProtoExtensionRangeStart of { Nothing -> a.descriptorProtoExtensionRangeStart; x -> x }
    , descriptorProtoExtensionRangeEnd = case b.descriptorProtoExtensionRangeEnd of { Nothing -> a.descriptorProtoExtensionRangeEnd; x -> x }
    , descriptorProtoExtensionRangeOptions = case b.descriptorProtoExtensionRangeOptions of { Nothing -> a.descriptorProtoExtensionRangeOptions; x -> x }
    , descriptorProtoExtensionRangeUnknownFields = a.descriptorProtoExtensionRangeUnknownFields <> b.descriptorProtoExtensionRangeUnknownFields
    }

instance Monoid DescriptorProto'ExtensionRange where
  mempty = defaultDescriptorProto'ExtensionRange

-- | Range of reserved tag numbers. Reserved tag numbers may not be used by
-- fields or extension ranges in the same message. Reserved ranges may
-- not overlap.
data DescriptorProto'ReservedRange = DescriptorProto'ReservedRange
  { descriptorProtoReservedRangeStart :: !(Maybe Int32)
  , descriptorProtoReservedRangeEnd :: !(Maybe Int32)
  , descriptorProtoReservedRangeUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultDescriptorProto'ReservedRange :: DescriptorProto'ReservedRange
defaultDescriptorProto'ReservedRange = DescriptorProto'ReservedRange
  { descriptorProtoReservedRangeStart = Nothing
  , descriptorProtoReservedRangeEnd = Nothing
  , descriptorProtoReservedRangeUnknownFields = []
  }

instance MessageEncode DescriptorProto'ReservedRange where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral v)) msg.descriptorProtoReservedRangeStart)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral v)) msg.descriptorProtoReservedRangeEnd)
    <> encodeUnknownFieldsSized msg.descriptorProtoReservedRangeUnknownFields

instance MessageDecode DescriptorProto'ReservedRange where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultDescriptorProto'ReservedRange
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_1 (msg { descriptorProtoReservedRangeStart = (Just v)}))
          (pure (case msg.descriptorProtoReservedRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoReservedRangeUnknownFields = reverse (msg.descriptorProtoReservedRangeUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> loop (msg { descriptorProtoReservedRangeEnd = (Just v)}))
          (pure (case msg.descriptorProtoReservedRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoReservedRangeUnknownFields = reverse (msg.descriptorProtoReservedRangeUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.descriptorProtoReservedRangeUnknownFields of { [] -> msg; _ -> msg { descriptorProtoReservedRangeUnknownFields = reverse (msg.descriptorProtoReservedRangeUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { descriptorProtoReservedRangeStart = (Just v)})
          2 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { descriptorProtoReservedRangeEnd = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { descriptorProtoReservedRangeUnknownFields = (uf : msg.descriptorProtoReservedRangeUnknownFields)}))

-- | Field descriptors for 'DescriptorProto'ReservedRange', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
descriptorProto'ReservedRangeFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor DescriptorProto'ReservedRange)
descriptorProto'ReservedRangeFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "start"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoReservedRangeStart
        , fdSet = \v m -> m { descriptorProtoReservedRangeStart = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "end"
        , fdNumber = 2
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoReservedRangeEnd
        , fdSet = \v m -> m { descriptorProtoReservedRangeEnd = v }
        })
    ]

instance ProtoMessage DescriptorProto'ReservedRange where
  protoMessageName _ = "google.protobuf.DescriptorProto.ReservedRange"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultDescriptorProto'ReservedRange
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = descriptorProto'ReservedRangeFieldDescriptors

instance IsMessage DescriptorProto'ReservedRange

instance Aeson.ToJSON DescriptorProto'ReservedRange where
  toJSON msg = jsonObject
      [ "start" .=: msg.descriptorProtoReservedRangeStart
      , "end" .=: msg.descriptorProtoReservedRangeEnd
      ]

instance Aeson.FromJSON DescriptorProto'ReservedRange where
  parseJSON = Aeson.withObject "DescriptorProto'ReservedRange" $ \obj -> do
    fld_descriptorProtoReservedRangeStart <- parseFieldMaybe obj "start"
    fld_descriptorProtoReservedRangeEnd <- parseFieldMaybe obj "end"
    pure defaultDescriptorProto'ReservedRange
      { descriptorProtoReservedRangeStart = maybe (descriptorProtoReservedRangeStart defaultDescriptorProto'ReservedRange) id fld_descriptorProtoReservedRangeStart
      , descriptorProtoReservedRangeEnd = maybe (descriptorProtoReservedRangeEnd defaultDescriptorProto'ReservedRange) id fld_descriptorProtoReservedRangeEnd
      }

instance Hashable DescriptorProto'ReservedRange where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (salt) msg.descriptorProtoReservedRangeStart) msg.descriptorProtoReservedRangeEnd

instance Proto.Extension.HasExtensions DescriptorProto'ReservedRange where
  messageUnknownFields = descriptorProtoReservedRangeUnknownFields
  setMessageUnknownFields !ufs msg = msg { descriptorProtoReservedRangeUnknownFields = ufs }

instance Semigroup DescriptorProto'ReservedRange where
  a <> b = DescriptorProto'ReservedRange
    { descriptorProtoReservedRangeStart = case b.descriptorProtoReservedRangeStart of { Nothing -> a.descriptorProtoReservedRangeStart; x -> x }
    , descriptorProtoReservedRangeEnd = case b.descriptorProtoReservedRangeEnd of { Nothing -> a.descriptorProtoReservedRangeEnd; x -> x }
    , descriptorProtoReservedRangeUnknownFields = a.descriptorProtoReservedRangeUnknownFields <> b.descriptorProtoReservedRangeUnknownFields
    }

instance Monoid DescriptorProto'ReservedRange where
  mempty = defaultDescriptorProto'ReservedRange

defaultDescriptorProto :: DescriptorProto
defaultDescriptorProto = DescriptorProto
  { descriptorProtoName = Nothing
  , descriptorProtoField = V.empty
  , descriptorProtoExtension = V.empty
  , descriptorProtoNestedType = V.empty
  , descriptorProtoEnumType = V.empty
  , descriptorProtoExtensionRange = V.empty
  , descriptorProtoOneofDecl = V.empty
  , descriptorProtoOptions = Nothing
  , descriptorProtoReservedRange = V.empty
  , descriptorProtoReservedName = V.empty
  , descriptorProtoUnknownFields = []
  }

instance MessageEncode DescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.descriptorProtoName)
    <> V.foldl' (\acc v -> acc <> archSubmessage 18 (buildSized v)) mempty msg.descriptorProtoField
    <> V.foldl' (\acc v -> acc <> archSubmessage 50 (buildSized v)) mempty msg.descriptorProtoExtension
    <> V.foldl' (\acc v -> acc <> archSubmessage 26 (buildSized v)) mempty msg.descriptorProtoNestedType
    <> V.foldl' (\acc v -> acc <> archSubmessage 34 (buildSized v)) mempty msg.descriptorProtoEnumType
    <> V.foldl' (\acc v -> acc <> archSubmessage 42 (buildSized v)) mempty msg.descriptorProtoExtensionRange
    <> V.foldl' (\acc v -> acc <> archSubmessage 66 (buildSized v)) mempty msg.descriptorProtoOneofDecl
    <> (maybe mempty (\v -> archSubmessage 58 (buildSized v)) msg.descriptorProtoOptions)
    <> V.foldl' (\acc v -> acc <> archSubmessage 74 (buildSized v)) mempty msg.descriptorProtoReservedRange
    <> V.foldl' (\acc v -> acc <> archString 82 v) mempty msg.descriptorProtoReservedName
    <> encodeUnknownFieldsSized msg.descriptorProtoUnknownFields

instance MessageDecode DescriptorProto where
  messageDecoder = stage_0 defaultDescriptorProto emptyGrowList emptyGrowList emptyGrowList emptyGrowList emptyGrowList emptyGrowList emptyGrowList emptyGrowList
    where
      stage_0 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { descriptorProtoName = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_1 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_1 msg (snocGrowList gl_0 v) gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_2 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x32 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_2 msg gl_0 (snocGrowList gl_1 v) gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_3 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_3 msg gl_0 gl_1 (snocGrowList gl_2 v) gl_3 gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_4 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_4 msg gl_0 gl_1 gl_2 (snocGrowList gl_3 v) gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_5 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x2a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_5 msg gl_0 gl_1 gl_2 gl_3 (snocGrowList gl_4 v) gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_6 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x42 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_6 msg gl_0 gl_1 gl_2 gl_3 gl_4 (snocGrowList gl_5 v) gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      stage_7 msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 =
        inOrderStage1
          (0x3a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { descriptorProtoOptions = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
          (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)
      loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7 = withTagM
        (pure (case msg.descriptorProtoUnknownFields of { [] -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7 }; _ -> msg { descriptorProtoField = growListToVector gl_0, descriptorProtoExtension = growListToVector gl_1, descriptorProtoNestedType = growListToVector gl_2, descriptorProtoEnumType = growListToVector gl_3, descriptorProtoExtensionRange = growListToVector gl_4, descriptorProtoOneofDecl = growListToVector gl_5, descriptorProtoReservedRange = growListToVector gl_6, descriptorProtoReservedName = growListToVector gl_7, descriptorProtoUnknownFields = reverse (msg.descriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { descriptorProtoName = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7
          2 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v) gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7
          6 -> do
            v <- decodeFieldMessage
            loop msg gl_0 (snocGrowList gl_1 v) gl_2 gl_3 gl_4 gl_5 gl_6 gl_7
          3 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 (snocGrowList gl_2 v) gl_3 gl_4 gl_5 gl_6 gl_7
          4 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 (snocGrowList gl_3 v) gl_4 gl_5 gl_6 gl_7
          5 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 gl_3 (snocGrowList gl_4 v) gl_5 gl_6 gl_7
          8 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 gl_3 gl_4 (snocGrowList gl_5 v) gl_6 gl_7
          7 -> do
            v <- decodeFieldMessage
            loop (msg { descriptorProtoOptions = (Just v)}) gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7
          9 -> do
            v <- decodeFieldMessage
            loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 (snocGrowList gl_6 v) gl_7
          10 -> do
            v <- decodeFieldString
            loop msg gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 (snocGrowList gl_7 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { descriptorProtoUnknownFields = (uf : msg.descriptorProtoUnknownFields)}) gl_0 gl_1 gl_2 gl_3 gl_4 gl_5 gl_6 gl_7)

-- | Field descriptors for 'DescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
descriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor DescriptorProto)
descriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoName
        , fdSet = \v m -> m { descriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "field"
        , fdNumber = 2
        , fdTypeDesc = MessageType "FieldDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoField
        , fdSet = \v m -> m { descriptorProtoField = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "extension"
        , fdNumber = 6
        , fdTypeDesc = MessageType "FieldDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoExtension
        , fdSet = \v m -> m { descriptorProtoExtension = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "nested_type"
        , fdNumber = 3
        , fdTypeDesc = MessageType "DescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoNestedType
        , fdSet = \v m -> m { descriptorProtoNestedType = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "enum_type"
        , fdNumber = 4
        , fdTypeDesc = MessageType "EnumDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoEnumType
        , fdSet = \v m -> m { descriptorProtoEnumType = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "extension_range"
        , fdNumber = 5
        , fdTypeDesc = MessageType "ExtensionRange"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoExtensionRange
        , fdSet = \v m -> m { descriptorProtoExtensionRange = v }
        })
    , (8, SomeField FieldDescriptor
        { fdName = "oneof_decl"
        , fdNumber = 8
        , fdTypeDesc = MessageType "OneofDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoOneofDecl
        , fdSet = \v m -> m { descriptorProtoOneofDecl = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 7
        , fdTypeDesc = MessageType "MessageOptions"
        , fdLabel = LabelOptional
        , fdGet = descriptorProtoOptions
        , fdSet = \v m -> m { descriptorProtoOptions = v }
        })
    , (9, SomeField FieldDescriptor
        { fdName = "reserved_range"
        , fdNumber = 9
        , fdTypeDesc = MessageType "ReservedRange"
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoReservedRange
        , fdSet = \v m -> m { descriptorProtoReservedRange = v }
        })
    , (10, SomeField FieldDescriptor
        { fdName = "reserved_name"
        , fdNumber = 10
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelRepeated
        , fdGet = descriptorProtoReservedName
        , fdSet = \v m -> m { descriptorProtoReservedName = v }
        })
    ]

instance ProtoMessage DescriptorProto where
  protoMessageName _ = "google.protobuf.DescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = descriptorProtoFieldDescriptors

instance IsMessage DescriptorProto

instance Aeson.ToJSON DescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.descriptorProtoName
      , "field" .=: msg.descriptorProtoField
      , "extension" .=: msg.descriptorProtoExtension
      , "nestedType" .=: msg.descriptorProtoNestedType
      , "enumType" .=: msg.descriptorProtoEnumType
      , "extensionRange" .=: msg.descriptorProtoExtensionRange
      , "oneofDecl" .=: msg.descriptorProtoOneofDecl
      , "options" .=: msg.descriptorProtoOptions
      , "reservedRange" .=: msg.descriptorProtoReservedRange
      , "reservedName" .=: msg.descriptorProtoReservedName
      ]

instance Aeson.FromJSON DescriptorProto where
  parseJSON = Aeson.withObject "DescriptorProto" $ \obj -> do
    fld_descriptorProtoName <- parseFieldMaybe obj "name"
    fld_descriptorProtoField <- parseFieldMaybe obj "field"
    fld_descriptorProtoExtension <- parseFieldMaybe obj "extension"
    fld_descriptorProtoNestedType <- parseFieldMaybe obj "nestedType"
    fld_descriptorProtoEnumType <- parseFieldMaybe obj "enumType"
    fld_descriptorProtoExtensionRange <- parseFieldMaybe obj "extensionRange"
    fld_descriptorProtoOneofDecl <- parseFieldMaybe obj "oneofDecl"
    fld_descriptorProtoOptions <- parseFieldMaybe obj "options"
    fld_descriptorProtoReservedRange <- parseFieldMaybe obj "reservedRange"
    fld_descriptorProtoReservedName <- parseFieldMaybe obj "reservedName"
    pure defaultDescriptorProto
      { descriptorProtoName = maybe (descriptorProtoName defaultDescriptorProto) id fld_descriptorProtoName
      , descriptorProtoField = maybe (descriptorProtoField defaultDescriptorProto) id fld_descriptorProtoField
      , descriptorProtoExtension = maybe (descriptorProtoExtension defaultDescriptorProto) id fld_descriptorProtoExtension
      , descriptorProtoNestedType = maybe (descriptorProtoNestedType defaultDescriptorProto) id fld_descriptorProtoNestedType
      , descriptorProtoEnumType = maybe (descriptorProtoEnumType defaultDescriptorProto) id fld_descriptorProtoEnumType
      , descriptorProtoExtensionRange = maybe (descriptorProtoExtensionRange defaultDescriptorProto) id fld_descriptorProtoExtensionRange
      , descriptorProtoOneofDecl = maybe (descriptorProtoOneofDecl defaultDescriptorProto) id fld_descriptorProtoOneofDecl
      , descriptorProtoOptions = maybe (descriptorProtoOptions defaultDescriptorProto) id fld_descriptorProtoOptions
      , descriptorProtoReservedRange = maybe (descriptorProtoReservedRange defaultDescriptorProto) id fld_descriptorProtoReservedRange
      , descriptorProtoReservedName = maybe (descriptorProtoReservedName defaultDescriptorProto) id fld_descriptorProtoReservedName
      }

instance Hashable DescriptorProto where
  hashWithSalt salt msg = V.foldl' hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (salt) msg.descriptorProtoName) msg.descriptorProtoField) msg.descriptorProtoExtension) msg.descriptorProtoNestedType) msg.descriptorProtoEnumType) msg.descriptorProtoExtensionRange) msg.descriptorProtoOneofDecl) msg.descriptorProtoOptions) msg.descriptorProtoReservedRange) msg.descriptorProtoReservedName

instance Proto.Extension.HasExtensions DescriptorProto where
  messageUnknownFields = descriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { descriptorProtoUnknownFields = ufs }

instance Semigroup DescriptorProto where
  a <> b = DescriptorProto
    { descriptorProtoName = case b.descriptorProtoName of { Nothing -> a.descriptorProtoName; x -> x }
    , descriptorProtoField = a.descriptorProtoField <> b.descriptorProtoField
    , descriptorProtoExtension = a.descriptorProtoExtension <> b.descriptorProtoExtension
    , descriptorProtoNestedType = a.descriptorProtoNestedType <> b.descriptorProtoNestedType
    , descriptorProtoEnumType = a.descriptorProtoEnumType <> b.descriptorProtoEnumType
    , descriptorProtoExtensionRange = a.descriptorProtoExtensionRange <> b.descriptorProtoExtensionRange
    , descriptorProtoOneofDecl = a.descriptorProtoOneofDecl <> b.descriptorProtoOneofDecl
    , descriptorProtoOptions = case b.descriptorProtoOptions of { Nothing -> a.descriptorProtoOptions; x -> x }
    , descriptorProtoReservedRange = a.descriptorProtoReservedRange <> b.descriptorProtoReservedRange
    , descriptorProtoReservedName = a.descriptorProtoReservedName <> b.descriptorProtoReservedName
    , descriptorProtoUnknownFields = a.descriptorProtoUnknownFields <> b.descriptorProtoUnknownFields
    }

instance Monoid DescriptorProto where
  mempty = defaultDescriptorProto

data ExtensionRangeOptions = ExtensionRangeOptions
  { extensionRangeOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , extensionRangeOptionsDeclaration :: !(V.Vector ExtensionRangeOptions'Declaration)
    -- ^ For external users: DO NOT USE. We are in the process of open sourcing
    -- extension declaration and executing internal cleanups before it can be
    -- used externally.
  , extensionRangeOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , extensionRangeOptionsVerification :: !(Maybe ExtensionRangeOptions'VerificationState)
    -- ^ The verification state of the range.
    -- TODO: flip the default to DECLARATION once all empty ranges
    -- are marked as UNVERIFIED.
  , extensionRangeOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data ExtensionRangeOptions'Declaration = ExtensionRangeOptions'Declaration
  { extensionRangeOptionsDeclarationNumber :: !(Maybe Int32)
    -- ^ The extension number declared within the extension range.
  , extensionRangeOptionsDeclarationFullName :: !(Maybe Text)
    -- ^ The fully-qualified name of the extension field. There must be a leading
    -- dot in front of the full name.
  , extensionRangeOptionsDeclarationType :: !(Maybe Text)
    -- ^ The fully-qualified type name of the extension field. Unlike
    -- Metadata.type, Declaration.type must have a leading dot for messages
    -- and enums.
  , extensionRangeOptionsDeclarationReserved :: !(Maybe Bool)
    -- ^ If true, indicates that the number is reserved in the extension range,
    -- and any extension field with the number will fail to compile. Set this
    -- when a declared extension field is deleted.
  , extensionRangeOptionsDeclarationRepeated :: !(Maybe Bool)
    -- ^ If true, indicates that the extension must be defined as repeated.
    -- Otherwise the extension must be defined as optional.
  , extensionRangeOptionsDeclarationUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultExtensionRangeOptions'Declaration :: ExtensionRangeOptions'Declaration
defaultExtensionRangeOptions'Declaration = ExtensionRangeOptions'Declaration
  { extensionRangeOptionsDeclarationNumber = Nothing
  , extensionRangeOptionsDeclarationFullName = Nothing
  , extensionRangeOptionsDeclarationType = Nothing
  , extensionRangeOptionsDeclarationReserved = Nothing
  , extensionRangeOptionsDeclarationRepeated = Nothing
  , extensionRangeOptionsDeclarationUnknownFields = []
  }

instance MessageEncode ExtensionRangeOptions'Declaration where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral v)) msg.extensionRangeOptionsDeclarationNumber)
    <> (maybe mempty (\v -> archString 18 v) msg.extensionRangeOptionsDeclarationFullName)
    <> (maybe mempty (\v -> archString 26 v) msg.extensionRangeOptionsDeclarationType)
    <> (maybe mempty (\v -> archBool 40 v) msg.extensionRangeOptionsDeclarationReserved)
    <> (maybe mempty (\v -> archBool 48 v) msg.extensionRangeOptionsDeclarationRepeated)
    <> encodeUnknownFieldsSized msg.extensionRangeOptionsDeclarationUnknownFields

instance MessageDecode ExtensionRangeOptions'Declaration where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultExtensionRangeOptions'Declaration
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_1 (msg { extensionRangeOptionsDeclarationNumber = (Just v)}))
          (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { extensionRangeOptionsDeclarationFullName = (Just v)}))
          (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_3 (msg { extensionRangeOptionsDeclarationType = (Just v)}))
          (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_4 (msg { extensionRangeOptionsDeclarationReserved = (Just v)}))
          (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
          (loop msg)
      stage_4 msg =
        inOrderStage1
          (0x30 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> loop (msg { extensionRangeOptionsDeclarationRepeated = (Just v)}))
          (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.extensionRangeOptionsDeclarationUnknownFields of { [] -> msg; _ -> msg { extensionRangeOptionsDeclarationUnknownFields = reverse (msg.extensionRangeOptionsDeclarationUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { extensionRangeOptionsDeclarationNumber = (Just v)})
          2 -> do
            v <- decodeFieldString
            loop (msg { extensionRangeOptionsDeclarationFullName = (Just v)})
          3 -> do
            v <- decodeFieldString
            loop (msg { extensionRangeOptionsDeclarationType = (Just v)})
          5 -> do
            v <- decodeFieldBool
            loop (msg { extensionRangeOptionsDeclarationReserved = (Just v)})
          6 -> do
            v <- decodeFieldBool
            loop (msg { extensionRangeOptionsDeclarationRepeated = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { extensionRangeOptionsDeclarationUnknownFields = (uf : msg.extensionRangeOptionsDeclarationUnknownFields)}))

-- | Field descriptors for 'ExtensionRangeOptions'Declaration', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
extensionRangeOptions'DeclarationFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor ExtensionRangeOptions'Declaration)
extensionRangeOptions'DeclarationFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "number"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsDeclarationNumber
        , fdSet = \v m -> m { extensionRangeOptionsDeclarationNumber = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "full_name"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsDeclarationFullName
        , fdSet = \v m -> m { extensionRangeOptionsDeclarationFullName = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "type"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsDeclarationType
        , fdSet = \v m -> m { extensionRangeOptionsDeclarationType = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "reserved"
        , fdNumber = 5
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsDeclarationReserved
        , fdSet = \v m -> m { extensionRangeOptionsDeclarationReserved = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "repeated"
        , fdNumber = 6
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsDeclarationRepeated
        , fdSet = \v m -> m { extensionRangeOptionsDeclarationRepeated = v }
        })
    ]

instance ProtoMessage ExtensionRangeOptions'Declaration where
  protoMessageName _ = "google.protobuf.ExtensionRangeOptions.Declaration"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultExtensionRangeOptions'Declaration
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = extensionRangeOptions'DeclarationFieldDescriptors

instance IsMessage ExtensionRangeOptions'Declaration

instance Aeson.ToJSON ExtensionRangeOptions'Declaration where
  toJSON msg = jsonObject
      [ "number" .=: msg.extensionRangeOptionsDeclarationNumber
      , "fullName" .=: msg.extensionRangeOptionsDeclarationFullName
      , "type" .=: msg.extensionRangeOptionsDeclarationType
      , "reserved" .=: msg.extensionRangeOptionsDeclarationReserved
      , "repeated" .=: msg.extensionRangeOptionsDeclarationRepeated
      ]

instance Aeson.FromJSON ExtensionRangeOptions'Declaration where
  parseJSON = Aeson.withObject "ExtensionRangeOptions'Declaration" $ \obj -> do
    fld_extensionRangeOptionsDeclarationNumber <- parseFieldMaybe obj "number"
    fld_extensionRangeOptionsDeclarationFullName <- parseFieldMaybe obj "fullName"
    fld_extensionRangeOptionsDeclarationType <- parseFieldMaybe obj "type"
    fld_extensionRangeOptionsDeclarationReserved <- parseFieldMaybe obj "reserved"
    fld_extensionRangeOptionsDeclarationRepeated <- parseFieldMaybe obj "repeated"
    pure defaultExtensionRangeOptions'Declaration
      { extensionRangeOptionsDeclarationNumber = maybe (extensionRangeOptionsDeclarationNumber defaultExtensionRangeOptions'Declaration) id fld_extensionRangeOptionsDeclarationNumber
      , extensionRangeOptionsDeclarationFullName = maybe (extensionRangeOptionsDeclarationFullName defaultExtensionRangeOptions'Declaration) id fld_extensionRangeOptionsDeclarationFullName
      , extensionRangeOptionsDeclarationType = maybe (extensionRangeOptionsDeclarationType defaultExtensionRangeOptions'Declaration) id fld_extensionRangeOptionsDeclarationType
      , extensionRangeOptionsDeclarationReserved = maybe (extensionRangeOptionsDeclarationReserved defaultExtensionRangeOptions'Declaration) id fld_extensionRangeOptionsDeclarationReserved
      , extensionRangeOptionsDeclarationRepeated = maybe (extensionRangeOptionsDeclarationRepeated defaultExtensionRangeOptions'Declaration) id fld_extensionRangeOptionsDeclarationRepeated
      }

instance Hashable ExtensionRangeOptions'Declaration where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.extensionRangeOptionsDeclarationNumber) msg.extensionRangeOptionsDeclarationFullName) msg.extensionRangeOptionsDeclarationType) msg.extensionRangeOptionsDeclarationReserved) msg.extensionRangeOptionsDeclarationRepeated

instance Proto.Extension.HasExtensions ExtensionRangeOptions'Declaration where
  messageUnknownFields = extensionRangeOptionsDeclarationUnknownFields
  setMessageUnknownFields !ufs msg = msg { extensionRangeOptionsDeclarationUnknownFields = ufs }

instance Semigroup ExtensionRangeOptions'Declaration where
  a <> b = ExtensionRangeOptions'Declaration
    { extensionRangeOptionsDeclarationNumber = case b.extensionRangeOptionsDeclarationNumber of { Nothing -> a.extensionRangeOptionsDeclarationNumber; x -> x }
    , extensionRangeOptionsDeclarationFullName = case b.extensionRangeOptionsDeclarationFullName of { Nothing -> a.extensionRangeOptionsDeclarationFullName; x -> x }
    , extensionRangeOptionsDeclarationType = case b.extensionRangeOptionsDeclarationType of { Nothing -> a.extensionRangeOptionsDeclarationType; x -> x }
    , extensionRangeOptionsDeclarationReserved = case b.extensionRangeOptionsDeclarationReserved of { Nothing -> a.extensionRangeOptionsDeclarationReserved; x -> x }
    , extensionRangeOptionsDeclarationRepeated = case b.extensionRangeOptionsDeclarationRepeated of { Nothing -> a.extensionRangeOptionsDeclarationRepeated; x -> x }
    , extensionRangeOptionsDeclarationUnknownFields = a.extensionRangeOptionsDeclarationUnknownFields <> b.extensionRangeOptionsDeclarationUnknownFields
    }

instance Monoid ExtensionRangeOptions'Declaration where
  mempty = defaultExtensionRangeOptions'Declaration

-- | The verification state of the extension range.
data ExtensionRangeOptions'VerificationState
  = ExtensionRangeOptions'VerificationState'Declaration
    -- ^ All the extensions of the range must be declared.
  | ExtensionRangeOptions'VerificationState'Unverified
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumExtensionRangeOptions'VerificationState :: ExtensionRangeOptions'VerificationState -> Int
toProtoEnumExtensionRangeOptions'VerificationState ExtensionRangeOptions'VerificationState'Declaration = 0
toProtoEnumExtensionRangeOptions'VerificationState ExtensionRangeOptions'VerificationState'Unverified = 1

fromProtoEnumExtensionRangeOptions'VerificationState :: Int -> Maybe ExtensionRangeOptions'VerificationState
fromProtoEnumExtensionRangeOptions'VerificationState 0 = Just ExtensionRangeOptions'VerificationState'Declaration
fromProtoEnumExtensionRangeOptions'VerificationState 1 = Just ExtensionRangeOptions'VerificationState'Unverified
fromProtoEnumExtensionRangeOptions'VerificationState _ = Nothing

instance MessageEncode ExtensionRangeOptions'VerificationState where
  buildSized _ = mempty
instance MessageDecode ExtensionRangeOptions'VerificationState where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON ExtensionRangeOptions'VerificationState where
  toJSON ExtensionRangeOptions'VerificationState'Declaration = Aeson.String "DECLARATION"
  toJSON ExtensionRangeOptions'VerificationState'Unverified = Aeson.String "UNVERIFIED"

instance Aeson.FromJSON ExtensionRangeOptions'VerificationState where
  parseJSON = \case
    Aeson.String "DECLARATION" -> pure ExtensionRangeOptions'VerificationState'Declaration
    Aeson.String "UNVERIFIED" -> pure ExtensionRangeOptions'VerificationState'Unverified
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for ExtensionRangeOptions'VerificationState"

instance Hashable ExtensionRangeOptions'VerificationState where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumExtensionRangeOptions'VerificationState x)

defaultExtensionRangeOptions :: ExtensionRangeOptions
defaultExtensionRangeOptions = ExtensionRangeOptions
  { extensionRangeOptionsUninterpretedOption = V.empty
  , extensionRangeOptionsDeclaration = V.empty
  , extensionRangeOptionsFeatures = Nothing
  , extensionRangeOptionsVerification = Nothing
  , extensionRangeOptionsUnknownFields = []
  }

instance MessageEncode ExtensionRangeOptions where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.extensionRangeOptionsUninterpretedOption
    <> V.foldl' (\acc v -> acc <> archSubmessage 18 (buildSized v)) mempty msg.extensionRangeOptionsDeclaration
    <> (maybe mempty (\v -> archSubmessage 402 (buildSized v)) msg.extensionRangeOptionsFeatures)
    <> (maybe mempty (\v -> archVarint 24 (fromIntegral (toProtoEnumExtensionRangeOptions'VerificationState v))) msg.extensionRangeOptionsVerification)
    <> encodeUnknownFieldsSized msg.extensionRangeOptionsUnknownFields

instance MessageDecode ExtensionRangeOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultExtensionRangeOptions emptyGrowList emptyGrowList
    where
      stage_0 msg gl_0 gl_1 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v) gl_1)
          (pure (case msg.extensionRangeOptionsUnknownFields of { [] -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1 }; _ -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1, extensionRangeOptionsUnknownFields = reverse (msg.extensionRangeOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_1 msg gl_0 gl_1 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_1 msg gl_0 (snocGrowList gl_1 v))
          (pure (case msg.extensionRangeOptionsUnknownFields of { [] -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1 }; _ -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1, extensionRangeOptionsUnknownFields = reverse (msg.extensionRangeOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_2 msg gl_0 gl_1 =
        inOrderStage
          0x392
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_3 (msg { extensionRangeOptionsFeatures = (Just v)}) gl_0 gl_1)
          (pure (case msg.extensionRangeOptionsUnknownFields of { [] -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1 }; _ -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1, extensionRangeOptionsUnknownFields = reverse (msg.extensionRangeOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_3 msg gl_0 gl_1 =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> loop (msg { extensionRangeOptionsVerification = (Just v)}) gl_0 gl_1)
          (pure (case msg.extensionRangeOptionsUnknownFields of { [] -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1 }; _ -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1, extensionRangeOptionsUnknownFields = reverse (msg.extensionRangeOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      loop msg gl_0 gl_1 = withTagM
        (pure (case msg.extensionRangeOptionsUnknownFields of { [] -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1 }; _ -> msg { extensionRangeOptionsUninterpretedOption = growListToVector gl_0, extensionRangeOptionsDeclaration = growListToVector gl_1, extensionRangeOptionsUnknownFields = reverse (msg.extensionRangeOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v) gl_1
          2 -> do
            v <- decodeFieldMessage
            loop msg gl_0 (snocGrowList gl_1 v)
          50 -> do
            v <- decodeFieldMessage
            loop (msg { extensionRangeOptionsFeatures = (Just v)}) gl_0 gl_1
          3 -> do
            v <- decodeFieldEnum
            loop (msg { extensionRangeOptionsVerification = (Just v)}) gl_0 gl_1
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { extensionRangeOptionsUnknownFields = (uf : msg.extensionRangeOptionsUnknownFields)}) gl_0 gl_1)

-- | Field descriptors for 'ExtensionRangeOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
extensionRangeOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor ExtensionRangeOptions)
extensionRangeOptionsFieldDescriptors =
  IntMap.fromList
    [ (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = extensionRangeOptionsUninterpretedOption
        , fdSet = \v m -> m { extensionRangeOptionsUninterpretedOption = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "declaration"
        , fdNumber = 2
        , fdTypeDesc = MessageType "Declaration"
        , fdLabel = LabelRepeated
        , fdGet = extensionRangeOptionsDeclaration
        , fdSet = \v m -> m { extensionRangeOptionsDeclaration = v }
        })
    , (50, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 50
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsFeatures
        , fdSet = \v m -> m { extensionRangeOptionsFeatures = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "verification"
        , fdNumber = 3
        , fdTypeDesc = MessageType "VerificationState"
        , fdLabel = LabelOptional
        , fdGet = extensionRangeOptionsVerification
        , fdSet = \v m -> m { extensionRangeOptionsVerification = v }
        })
    ]

instance ProtoMessage ExtensionRangeOptions where
  protoMessageName _ = "google.protobuf.ExtensionRangeOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultExtensionRangeOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = extensionRangeOptionsFieldDescriptors

instance IsMessage ExtensionRangeOptions

instance Aeson.ToJSON ExtensionRangeOptions where
  toJSON msg = jsonObject
      [ "uninterpretedOption" .=: msg.extensionRangeOptionsUninterpretedOption
      , "declaration" .=: msg.extensionRangeOptionsDeclaration
      , "features" .=: msg.extensionRangeOptionsFeatures
      , "verification" .=: msg.extensionRangeOptionsVerification
      ]

instance Aeson.FromJSON ExtensionRangeOptions where
  parseJSON = Aeson.withObject "ExtensionRangeOptions" $ \obj -> do
    fld_extensionRangeOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    fld_extensionRangeOptionsDeclaration <- parseFieldMaybe obj "declaration"
    fld_extensionRangeOptionsFeatures <- parseFieldMaybe obj "features"
    fld_extensionRangeOptionsVerification <- parseFieldMaybe obj "verification"
    pure defaultExtensionRangeOptions
      { extensionRangeOptionsUninterpretedOption = maybe (extensionRangeOptionsUninterpretedOption defaultExtensionRangeOptions) id fld_extensionRangeOptionsUninterpretedOption
      , extensionRangeOptionsDeclaration = maybe (extensionRangeOptionsDeclaration defaultExtensionRangeOptions) id fld_extensionRangeOptionsDeclaration
      , extensionRangeOptionsFeatures = maybe (extensionRangeOptionsFeatures defaultExtensionRangeOptions) id fld_extensionRangeOptionsFeatures
      , extensionRangeOptionsVerification = maybe (extensionRangeOptionsVerification defaultExtensionRangeOptions) id fld_extensionRangeOptionsVerification
      }

instance Hashable ExtensionRangeOptions where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (salt) msg.extensionRangeOptionsUninterpretedOption) msg.extensionRangeOptionsDeclaration) msg.extensionRangeOptionsFeatures) msg.extensionRangeOptionsVerification

instance Proto.Extension.HasExtensions ExtensionRangeOptions where
  messageUnknownFields = extensionRangeOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { extensionRangeOptionsUnknownFields = ufs }

instance Semigroup ExtensionRangeOptions where
  a <> b = ExtensionRangeOptions
    { extensionRangeOptionsUninterpretedOption = a.extensionRangeOptionsUninterpretedOption <> b.extensionRangeOptionsUninterpretedOption
    , extensionRangeOptionsDeclaration = a.extensionRangeOptionsDeclaration <> b.extensionRangeOptionsDeclaration
    , extensionRangeOptionsFeatures = case b.extensionRangeOptionsFeatures of { Nothing -> a.extensionRangeOptionsFeatures; x -> x }
    , extensionRangeOptionsVerification = case b.extensionRangeOptionsVerification of { Nothing -> a.extensionRangeOptionsVerification; x -> x }
    , extensionRangeOptionsUnknownFields = a.extensionRangeOptionsUnknownFields <> b.extensionRangeOptionsUnknownFields
    }

instance Monoid ExtensionRangeOptions where
  mempty = defaultExtensionRangeOptions

-- | Describes a field within a message.
data FieldDescriptorProto = FieldDescriptorProto
  { fieldDescriptorProtoName :: !(Maybe Text)
  , fieldDescriptorProtoNumber :: !(Maybe Int32)
  , fieldDescriptorProtoLabel :: !(Maybe FieldDescriptorProto'Label)
  , fieldDescriptorProtoType :: !(Maybe FieldDescriptorProto'Type)
    -- ^ If type_name is set, this need not be set.  If both this and type_name
    -- are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
  , fieldDescriptorProtoTypeName :: !(Maybe Text)
    -- ^ For message and enum types, this is the name of the type.  If the name
    -- starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
    -- rules are used to find the type (i.e. first the nested types within this
    -- message are searched, then within the parent, on up to the root
    -- namespace).
  , fieldDescriptorProtoExtendee :: !(Maybe Text)
    -- ^ For extensions, this is the name of the type being extended.  It is
    -- resolved in the same manner as type_name.
  , fieldDescriptorProtoDefaultValue :: !(Maybe Text)
    -- ^ For numeric types, contains the original text representation of the value.
    -- For booleans, "true" or "false".
    -- For strings, contains the default text contents (not escaped in any way).
    -- For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
  , fieldDescriptorProtoOneofIndex :: !(Maybe Int32)
    -- ^ If set, gives the index of a oneof in the containing type's oneof_decl
    -- list.  This field is a member of that oneof.
  , fieldDescriptorProtoJsonName :: !(Maybe Text)
    -- ^ JSON name of this field. The value is set by protocol compiler. If the
    -- user has set a "json_name" option on this field, that option's value
    -- will be used. Otherwise, it's deduced from the field's name by converting
    -- it to camelCase.
  , fieldDescriptorProtoOptions :: !(Maybe FieldOptions)
  , fieldDescriptorProtoProto3Optional :: !(Maybe Bool)
    -- ^ If true, this is a proto3 "optional". When a proto3 field is optional, it
    -- tracks presence regardless of field type.
    -- 
    -- When proto3_optional is true, this field must belong to a oneof to signal
    -- to old proto3 clients that presence is tracked for this field. This oneof
    -- is known as a "synthetic" oneof, and this field must be its sole member
    -- (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
    -- exist in the descriptor only, and do not generate any API. Synthetic oneofs
    -- must be ordered after all "real" oneofs.
    -- 
    -- For message fields, proto3_optional doesn't create any semantic change,
    -- since non-repeated message fields always track presence. However it still
    -- indicates the semantic detail of whether the user wrote "optional" or not.
    -- This can be useful for round-tripping the .proto file. For consistency we
    -- give message fields a synthetic oneof also, even though it is not required
    -- to track presence. This is especially important because the parser can't
    -- tell if a field is a message or an enum, so it must always create a
    -- synthetic oneof.
    -- 
    -- Proto2 optional fields do not set this flag, because they already indicate
    -- optional with `LABEL_OPTIONAL`.
  , fieldDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data FieldDescriptorProto'Type
  = FieldDescriptorProto'Type'TypeDouble
    -- ^ 0 is reserved for errors.
    -- Order is weird for historical reasons.
  | FieldDescriptorProto'Type'TypeFloat
  | FieldDescriptorProto'Type'TypeInt64
    -- ^ Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
    -- negative values are likely.
  | FieldDescriptorProto'Type'TypeUint64
  | FieldDescriptorProto'Type'TypeInt32
    -- ^ Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
    -- negative values are likely.
  | FieldDescriptorProto'Type'TypeFixed64
  | FieldDescriptorProto'Type'TypeFixed32
  | FieldDescriptorProto'Type'TypeBool
  | FieldDescriptorProto'Type'TypeString
  | FieldDescriptorProto'Type'TypeGroup
    -- ^ Tag-delimited aggregate.
    -- Group type is deprecated and not supported after google.protobuf. However, Proto3
    -- implementations should still be able to parse the group wire format and
    -- treat group fields as unknown fields.  In Editions, the group wire format
    -- can be enabled via the `message_encoding` feature.
  | FieldDescriptorProto'Type'TypeMessage
  | FieldDescriptorProto'Type'TypeBytes
    -- ^ New in version 2.
  | FieldDescriptorProto'Type'TypeUint32
  | FieldDescriptorProto'Type'TypeEnum
  | FieldDescriptorProto'Type'TypeSfixed32
  | FieldDescriptorProto'Type'TypeSfixed64
  | FieldDescriptorProto'Type'TypeSint32
  | FieldDescriptorProto'Type'TypeSint64
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldDescriptorProto'Type :: FieldDescriptorProto'Type -> Int
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeDouble = 1
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeFloat = 2
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeInt64 = 3
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeUint64 = 4
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeInt32 = 5
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeFixed64 = 6
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeFixed32 = 7
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeBool = 8
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeString = 9
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeGroup = 10
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeMessage = 11
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeBytes = 12
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeUint32 = 13
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeEnum = 14
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeSfixed32 = 15
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeSfixed64 = 16
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeSint32 = 17
toProtoEnumFieldDescriptorProto'Type FieldDescriptorProto'Type'TypeSint64 = 18

fromProtoEnumFieldDescriptorProto'Type :: Int -> Maybe FieldDescriptorProto'Type
fromProtoEnumFieldDescriptorProto'Type 1 = Just FieldDescriptorProto'Type'TypeDouble
fromProtoEnumFieldDescriptorProto'Type 2 = Just FieldDescriptorProto'Type'TypeFloat
fromProtoEnumFieldDescriptorProto'Type 3 = Just FieldDescriptorProto'Type'TypeInt64
fromProtoEnumFieldDescriptorProto'Type 4 = Just FieldDescriptorProto'Type'TypeUint64
fromProtoEnumFieldDescriptorProto'Type 5 = Just FieldDescriptorProto'Type'TypeInt32
fromProtoEnumFieldDescriptorProto'Type 6 = Just FieldDescriptorProto'Type'TypeFixed64
fromProtoEnumFieldDescriptorProto'Type 7 = Just FieldDescriptorProto'Type'TypeFixed32
fromProtoEnumFieldDescriptorProto'Type 8 = Just FieldDescriptorProto'Type'TypeBool
fromProtoEnumFieldDescriptorProto'Type 9 = Just FieldDescriptorProto'Type'TypeString
fromProtoEnumFieldDescriptorProto'Type 10 = Just FieldDescriptorProto'Type'TypeGroup
fromProtoEnumFieldDescriptorProto'Type 11 = Just FieldDescriptorProto'Type'TypeMessage
fromProtoEnumFieldDescriptorProto'Type 12 = Just FieldDescriptorProto'Type'TypeBytes
fromProtoEnumFieldDescriptorProto'Type 13 = Just FieldDescriptorProto'Type'TypeUint32
fromProtoEnumFieldDescriptorProto'Type 14 = Just FieldDescriptorProto'Type'TypeEnum
fromProtoEnumFieldDescriptorProto'Type 15 = Just FieldDescriptorProto'Type'TypeSfixed32
fromProtoEnumFieldDescriptorProto'Type 16 = Just FieldDescriptorProto'Type'TypeSfixed64
fromProtoEnumFieldDescriptorProto'Type 17 = Just FieldDescriptorProto'Type'TypeSint32
fromProtoEnumFieldDescriptorProto'Type 18 = Just FieldDescriptorProto'Type'TypeSint64
fromProtoEnumFieldDescriptorProto'Type _ = Nothing

instance MessageEncode FieldDescriptorProto'Type where
  buildSized _ = mempty
instance MessageDecode FieldDescriptorProto'Type where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldDescriptorProto'Type where
  toJSON FieldDescriptorProto'Type'TypeDouble = Aeson.String "TYPE_DOUBLE"
  toJSON FieldDescriptorProto'Type'TypeFloat = Aeson.String "TYPE_FLOAT"
  toJSON FieldDescriptorProto'Type'TypeInt64 = Aeson.String "TYPE_INT64"
  toJSON FieldDescriptorProto'Type'TypeUint64 = Aeson.String "TYPE_UINT64"
  toJSON FieldDescriptorProto'Type'TypeInt32 = Aeson.String "TYPE_INT32"
  toJSON FieldDescriptorProto'Type'TypeFixed64 = Aeson.String "TYPE_FIXED64"
  toJSON FieldDescriptorProto'Type'TypeFixed32 = Aeson.String "TYPE_FIXED32"
  toJSON FieldDescriptorProto'Type'TypeBool = Aeson.String "TYPE_BOOL"
  toJSON FieldDescriptorProto'Type'TypeString = Aeson.String "TYPE_STRING"
  toJSON FieldDescriptorProto'Type'TypeGroup = Aeson.String "TYPE_GROUP"
  toJSON FieldDescriptorProto'Type'TypeMessage = Aeson.String "TYPE_MESSAGE"
  toJSON FieldDescriptorProto'Type'TypeBytes = Aeson.String "TYPE_BYTES"
  toJSON FieldDescriptorProto'Type'TypeUint32 = Aeson.String "TYPE_UINT32"
  toJSON FieldDescriptorProto'Type'TypeEnum = Aeson.String "TYPE_ENUM"
  toJSON FieldDescriptorProto'Type'TypeSfixed32 = Aeson.String "TYPE_SFIXED32"
  toJSON FieldDescriptorProto'Type'TypeSfixed64 = Aeson.String "TYPE_SFIXED64"
  toJSON FieldDescriptorProto'Type'TypeSint32 = Aeson.String "TYPE_SINT32"
  toJSON FieldDescriptorProto'Type'TypeSint64 = Aeson.String "TYPE_SINT64"

instance Aeson.FromJSON FieldDescriptorProto'Type where
  parseJSON = \case
    Aeson.String "TYPE_DOUBLE" -> pure FieldDescriptorProto'Type'TypeDouble
    Aeson.String "TYPE_FLOAT" -> pure FieldDescriptorProto'Type'TypeFloat
    Aeson.String "TYPE_INT64" -> pure FieldDescriptorProto'Type'TypeInt64
    Aeson.String "TYPE_UINT64" -> pure FieldDescriptorProto'Type'TypeUint64
    Aeson.String "TYPE_INT32" -> pure FieldDescriptorProto'Type'TypeInt32
    Aeson.String "TYPE_FIXED64" -> pure FieldDescriptorProto'Type'TypeFixed64
    Aeson.String "TYPE_FIXED32" -> pure FieldDescriptorProto'Type'TypeFixed32
    Aeson.String "TYPE_BOOL" -> pure FieldDescriptorProto'Type'TypeBool
    Aeson.String "TYPE_STRING" -> pure FieldDescriptorProto'Type'TypeString
    Aeson.String "TYPE_GROUP" -> pure FieldDescriptorProto'Type'TypeGroup
    Aeson.String "TYPE_MESSAGE" -> pure FieldDescriptorProto'Type'TypeMessage
    Aeson.String "TYPE_BYTES" -> pure FieldDescriptorProto'Type'TypeBytes
    Aeson.String "TYPE_UINT32" -> pure FieldDescriptorProto'Type'TypeUint32
    Aeson.String "TYPE_ENUM" -> pure FieldDescriptorProto'Type'TypeEnum
    Aeson.String "TYPE_SFIXED32" -> pure FieldDescriptorProto'Type'TypeSfixed32
    Aeson.String "TYPE_SFIXED64" -> pure FieldDescriptorProto'Type'TypeSfixed64
    Aeson.String "TYPE_SINT32" -> pure FieldDescriptorProto'Type'TypeSint32
    Aeson.String "TYPE_SINT64" -> pure FieldDescriptorProto'Type'TypeSint64
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldDescriptorProto'Type"

instance Hashable FieldDescriptorProto'Type where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldDescriptorProto'Type x)

data FieldDescriptorProto'Label
  = FieldDescriptorProto'Label'LabelOptional
    -- ^ 0 is reserved for errors
  | FieldDescriptorProto'Label'LabelRepeated
  | FieldDescriptorProto'Label'LabelRequired
    -- ^ The required label is only allowed in google.protobuf.  In proto3 and Editions
    -- it's explicitly prohibited.  In Editions, the `field_presence` feature
    -- can be used to get this behavior.
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldDescriptorProto'Label :: FieldDescriptorProto'Label -> Int
toProtoEnumFieldDescriptorProto'Label FieldDescriptorProto'Label'LabelOptional = 1
toProtoEnumFieldDescriptorProto'Label FieldDescriptorProto'Label'LabelRepeated = 3
toProtoEnumFieldDescriptorProto'Label FieldDescriptorProto'Label'LabelRequired = 2

fromProtoEnumFieldDescriptorProto'Label :: Int -> Maybe FieldDescriptorProto'Label
fromProtoEnumFieldDescriptorProto'Label 1 = Just FieldDescriptorProto'Label'LabelOptional
fromProtoEnumFieldDescriptorProto'Label 3 = Just FieldDescriptorProto'Label'LabelRepeated
fromProtoEnumFieldDescriptorProto'Label 2 = Just FieldDescriptorProto'Label'LabelRequired
fromProtoEnumFieldDescriptorProto'Label _ = Nothing

instance MessageEncode FieldDescriptorProto'Label where
  buildSized _ = mempty
instance MessageDecode FieldDescriptorProto'Label where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldDescriptorProto'Label where
  toJSON FieldDescriptorProto'Label'LabelOptional = Aeson.String "LABEL_OPTIONAL"
  toJSON FieldDescriptorProto'Label'LabelRepeated = Aeson.String "LABEL_REPEATED"
  toJSON FieldDescriptorProto'Label'LabelRequired = Aeson.String "LABEL_REQUIRED"

instance Aeson.FromJSON FieldDescriptorProto'Label where
  parseJSON = \case
    Aeson.String "LABEL_OPTIONAL" -> pure FieldDescriptorProto'Label'LabelOptional
    Aeson.String "LABEL_REPEATED" -> pure FieldDescriptorProto'Label'LabelRepeated
    Aeson.String "LABEL_REQUIRED" -> pure FieldDescriptorProto'Label'LabelRequired
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldDescriptorProto'Label"

instance Hashable FieldDescriptorProto'Label where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldDescriptorProto'Label x)

defaultFieldDescriptorProto :: FieldDescriptorProto
defaultFieldDescriptorProto = FieldDescriptorProto
  { fieldDescriptorProtoName = Nothing
  , fieldDescriptorProtoNumber = Nothing
  , fieldDescriptorProtoLabel = Nothing
  , fieldDescriptorProtoType = Nothing
  , fieldDescriptorProtoTypeName = Nothing
  , fieldDescriptorProtoExtendee = Nothing
  , fieldDescriptorProtoDefaultValue = Nothing
  , fieldDescriptorProtoOneofIndex = Nothing
  , fieldDescriptorProtoJsonName = Nothing
  , fieldDescriptorProtoOptions = Nothing
  , fieldDescriptorProtoProto3Optional = Nothing
  , fieldDescriptorProtoUnknownFields = []
  }

instance MessageEncode FieldDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.fieldDescriptorProtoName)
    <> (maybe mempty (\v -> archVarint 24 (fromIntegral v)) msg.fieldDescriptorProtoNumber)
    <> (maybe mempty (\v -> archVarint 32 (fromIntegral (toProtoEnumFieldDescriptorProto'Label v))) msg.fieldDescriptorProtoLabel)
    <> (maybe mempty (\v -> archVarint 40 (fromIntegral (toProtoEnumFieldDescriptorProto'Type v))) msg.fieldDescriptorProtoType)
    <> (maybe mempty (\v -> archString 50 v) msg.fieldDescriptorProtoTypeName)
    <> (maybe mempty (\v -> archString 18 v) msg.fieldDescriptorProtoExtendee)
    <> (maybe mempty (\v -> archString 58 v) msg.fieldDescriptorProtoDefaultValue)
    <> (maybe mempty (\v -> archVarint 72 (fromIntegral v)) msg.fieldDescriptorProtoOneofIndex)
    <> (maybe mempty (\v -> archString 82 v) msg.fieldDescriptorProtoJsonName)
    <> (maybe mempty (\v -> archSubmessage 66 (buildSized v)) msg.fieldDescriptorProtoOptions)
    <> (maybe mempty (\v -> archBool 136 v) msg.fieldDescriptorProtoProto3Optional)
    <> encodeUnknownFieldsSized msg.fieldDescriptorProtoUnknownFields

instance MessageDecode FieldDescriptorProto where
  messageDecoder = stage_0 defaultFieldDescriptorProto
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { fieldDescriptorProtoName = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_2 (msg { fieldDescriptorProtoNumber = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_3 (msg { fieldDescriptorProtoLabel = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_4 (msg { fieldDescriptorProtoType = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_4 msg =
        inOrderStage1
          (0x32 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_5 (msg { fieldDescriptorProtoTypeName = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_5 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_6 (msg { fieldDescriptorProtoExtendee = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_6 msg =
        inOrderStage1
          (0x3a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_7 (msg { fieldDescriptorProtoDefaultValue = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_7 msg =
        inOrderStage1
          (0x48 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> loop (msg { fieldDescriptorProtoOneofIndex = (Just v)}))
          (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.fieldDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { fieldDescriptorProtoUnknownFields = reverse (msg.fieldDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { fieldDescriptorProtoName = (Just v)})
          3 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { fieldDescriptorProtoNumber = (Just v)})
          4 -> do
            v <- decodeFieldEnum
            loop (msg { fieldDescriptorProtoLabel = (Just v)})
          5 -> do
            v <- decodeFieldEnum
            loop (msg { fieldDescriptorProtoType = (Just v)})
          6 -> do
            v <- decodeFieldString
            loop (msg { fieldDescriptorProtoTypeName = (Just v)})
          2 -> do
            v <- decodeFieldString
            loop (msg { fieldDescriptorProtoExtendee = (Just v)})
          7 -> do
            v <- decodeFieldString
            loop (msg { fieldDescriptorProtoDefaultValue = (Just v)})
          9 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { fieldDescriptorProtoOneofIndex = (Just v)})
          10 -> do
            v <- decodeFieldString
            loop (msg { fieldDescriptorProtoJsonName = (Just v)})
          8 -> do
            v <- decodeFieldMessage
            loop (msg { fieldDescriptorProtoOptions = (Just v)})
          17 -> do
            v <- decodeFieldBool
            loop (msg { fieldDescriptorProtoProto3Optional = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fieldDescriptorProtoUnknownFields = (uf : msg.fieldDescriptorProtoUnknownFields)}))

-- | Field descriptors for 'FieldDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fieldDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FieldDescriptorProto)
fieldDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoName
        , fdSet = \v m -> m { fieldDescriptorProtoName = v }
        }), (3, SomeField FieldDescriptor
        { fdName = "number"
        , fdNumber = 3
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoNumber
        , fdSet = \v m -> m { fieldDescriptorProtoNumber = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "label"
        , fdNumber = 4
        , fdTypeDesc = MessageType "Label"
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoLabel
        , fdSet = \v m -> m { fieldDescriptorProtoLabel = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "type"
        , fdNumber = 5
        , fdTypeDesc = MessageType "Type"
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoType
        , fdSet = \v m -> m { fieldDescriptorProtoType = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "type_name"
        , fdNumber = 6
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoTypeName
        , fdSet = \v m -> m { fieldDescriptorProtoTypeName = v }
        })
    , (2, SomeField FieldDescriptor
        { fdName = "extendee"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoExtendee
        , fdSet = \v m -> m { fieldDescriptorProtoExtendee = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "default_value"
        , fdNumber = 7
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoDefaultValue
        , fdSet = \v m -> m { fieldDescriptorProtoDefaultValue = v }
        })
    , (9, SomeField FieldDescriptor
        { fdName = "oneof_index"
        , fdNumber = 9
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoOneofIndex
        , fdSet = \v m -> m { fieldDescriptorProtoOneofIndex = v }
        })
    , (10, SomeField FieldDescriptor
        { fdName = "json_name"
        , fdNumber = 10
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoJsonName
        , fdSet = \v m -> m { fieldDescriptorProtoJsonName = v }
        })
    , (8, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 8
        , fdTypeDesc = MessageType "FieldOptions"
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoOptions
        , fdSet = \v m -> m { fieldDescriptorProtoOptions = v }
        })
    , (17, SomeField FieldDescriptor
        { fdName = "proto3_optional"
        , fdNumber = 17
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldDescriptorProtoProto3Optional
        , fdSet = \v m -> m { fieldDescriptorProtoProto3Optional = v }
        })
    ]

instance ProtoMessage FieldDescriptorProto where
  protoMessageName _ = "google.protobuf.FieldDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFieldDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fieldDescriptorProtoFieldDescriptors

instance IsMessage FieldDescriptorProto

instance Aeson.ToJSON FieldDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.fieldDescriptorProtoName
      , "number" .=: msg.fieldDescriptorProtoNumber
      , "label" .=: msg.fieldDescriptorProtoLabel
      , "type" .=: msg.fieldDescriptorProtoType
      , "typeName" .=: msg.fieldDescriptorProtoTypeName
      , "extendee" .=: msg.fieldDescriptorProtoExtendee
      , "defaultValue" .=: msg.fieldDescriptorProtoDefaultValue
      , "oneofIndex" .=: msg.fieldDescriptorProtoOneofIndex
      , "jsonName" .=: msg.fieldDescriptorProtoJsonName
      , "options" .=: msg.fieldDescriptorProtoOptions
      , "proto3Optional" .=: msg.fieldDescriptorProtoProto3Optional
      ]

instance Aeson.FromJSON FieldDescriptorProto where
  parseJSON = Aeson.withObject "FieldDescriptorProto" $ \obj -> do
    fld_fieldDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_fieldDescriptorProtoNumber <- parseFieldMaybe obj "number"
    fld_fieldDescriptorProtoLabel <- parseFieldMaybe obj "label"
    fld_fieldDescriptorProtoType <- parseFieldMaybe obj "type"
    fld_fieldDescriptorProtoTypeName <- parseFieldMaybe obj "typeName"
    fld_fieldDescriptorProtoExtendee <- parseFieldMaybe obj "extendee"
    fld_fieldDescriptorProtoDefaultValue <- parseFieldMaybe obj "defaultValue"
    fld_fieldDescriptorProtoOneofIndex <- parseFieldMaybe obj "oneofIndex"
    fld_fieldDescriptorProtoJsonName <- parseFieldMaybe obj "jsonName"
    fld_fieldDescriptorProtoOptions <- parseFieldMaybe obj "options"
    fld_fieldDescriptorProtoProto3Optional <- parseFieldMaybe obj "proto3Optional"
    pure defaultFieldDescriptorProto
      { fieldDescriptorProtoName = maybe (fieldDescriptorProtoName defaultFieldDescriptorProto) id fld_fieldDescriptorProtoName
      , fieldDescriptorProtoNumber = maybe (fieldDescriptorProtoNumber defaultFieldDescriptorProto) id fld_fieldDescriptorProtoNumber
      , fieldDescriptorProtoLabel = maybe (fieldDescriptorProtoLabel defaultFieldDescriptorProto) id fld_fieldDescriptorProtoLabel
      , fieldDescriptorProtoType = maybe (fieldDescriptorProtoType defaultFieldDescriptorProto) id fld_fieldDescriptorProtoType
      , fieldDescriptorProtoTypeName = maybe (fieldDescriptorProtoTypeName defaultFieldDescriptorProto) id fld_fieldDescriptorProtoTypeName
      , fieldDescriptorProtoExtendee = maybe (fieldDescriptorProtoExtendee defaultFieldDescriptorProto) id fld_fieldDescriptorProtoExtendee
      , fieldDescriptorProtoDefaultValue = maybe (fieldDescriptorProtoDefaultValue defaultFieldDescriptorProto) id fld_fieldDescriptorProtoDefaultValue
      , fieldDescriptorProtoOneofIndex = maybe (fieldDescriptorProtoOneofIndex defaultFieldDescriptorProto) id fld_fieldDescriptorProtoOneofIndex
      , fieldDescriptorProtoJsonName = maybe (fieldDescriptorProtoJsonName defaultFieldDescriptorProto) id fld_fieldDescriptorProtoJsonName
      , fieldDescriptorProtoOptions = maybe (fieldDescriptorProtoOptions defaultFieldDescriptorProto) id fld_fieldDescriptorProtoOptions
      , fieldDescriptorProtoProto3Optional = maybe (fieldDescriptorProtoProto3Optional defaultFieldDescriptorProto) id fld_fieldDescriptorProtoProto3Optional
      }

instance Hashable FieldDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.fieldDescriptorProtoName) msg.fieldDescriptorProtoNumber) msg.fieldDescriptorProtoLabel) msg.fieldDescriptorProtoType) msg.fieldDescriptorProtoTypeName) msg.fieldDescriptorProtoExtendee) msg.fieldDescriptorProtoDefaultValue) msg.fieldDescriptorProtoOneofIndex) msg.fieldDescriptorProtoJsonName) msg.fieldDescriptorProtoOptions) msg.fieldDescriptorProtoProto3Optional

instance Proto.Extension.HasExtensions FieldDescriptorProto where
  messageUnknownFields = fieldDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { fieldDescriptorProtoUnknownFields = ufs }

instance Semigroup FieldDescriptorProto where
  a <> b = FieldDescriptorProto
    { fieldDescriptorProtoName = case b.fieldDescriptorProtoName of { Nothing -> a.fieldDescriptorProtoName; x -> x }
    , fieldDescriptorProtoNumber = case b.fieldDescriptorProtoNumber of { Nothing -> a.fieldDescriptorProtoNumber; x -> x }
    , fieldDescriptorProtoLabel = case b.fieldDescriptorProtoLabel of { Nothing -> a.fieldDescriptorProtoLabel; x -> x }
    , fieldDescriptorProtoType = case b.fieldDescriptorProtoType of { Nothing -> a.fieldDescriptorProtoType; x -> x }
    , fieldDescriptorProtoTypeName = case b.fieldDescriptorProtoTypeName of { Nothing -> a.fieldDescriptorProtoTypeName; x -> x }
    , fieldDescriptorProtoExtendee = case b.fieldDescriptorProtoExtendee of { Nothing -> a.fieldDescriptorProtoExtendee; x -> x }
    , fieldDescriptorProtoDefaultValue = case b.fieldDescriptorProtoDefaultValue of { Nothing -> a.fieldDescriptorProtoDefaultValue; x -> x }
    , fieldDescriptorProtoOneofIndex = case b.fieldDescriptorProtoOneofIndex of { Nothing -> a.fieldDescriptorProtoOneofIndex; x -> x }
    , fieldDescriptorProtoJsonName = case b.fieldDescriptorProtoJsonName of { Nothing -> a.fieldDescriptorProtoJsonName; x -> x }
    , fieldDescriptorProtoOptions = case b.fieldDescriptorProtoOptions of { Nothing -> a.fieldDescriptorProtoOptions; x -> x }
    , fieldDescriptorProtoProto3Optional = case b.fieldDescriptorProtoProto3Optional of { Nothing -> a.fieldDescriptorProtoProto3Optional; x -> x }
    , fieldDescriptorProtoUnknownFields = a.fieldDescriptorProtoUnknownFields <> b.fieldDescriptorProtoUnknownFields
    }

instance Monoid FieldDescriptorProto where
  mempty = defaultFieldDescriptorProto

-- | Describes a oneof.
data OneofDescriptorProto = OneofDescriptorProto
  { oneofDescriptorProtoName :: !(Maybe Text)
  , oneofDescriptorProtoOptions :: !(Maybe OneofOptions)
  , oneofDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultOneofDescriptorProto :: OneofDescriptorProto
defaultOneofDescriptorProto = OneofDescriptorProto
  { oneofDescriptorProtoName = Nothing
  , oneofDescriptorProtoOptions = Nothing
  , oneofDescriptorProtoUnknownFields = []
  }

instance MessageEncode OneofDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.oneofDescriptorProtoName)
    <> (maybe mempty (\v -> archSubmessage 18 (buildSized v)) msg.oneofDescriptorProtoOptions)
    <> encodeUnknownFieldsSized msg.oneofDescriptorProtoUnknownFields

instance MessageDecode OneofDescriptorProto where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultOneofDescriptorProto
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { oneofDescriptorProtoName = (Just v)}))
          (pure (case msg.oneofDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { oneofDescriptorProtoUnknownFields = reverse (msg.oneofDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { oneofDescriptorProtoOptions = (Just v)}))
          (pure (case msg.oneofDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { oneofDescriptorProtoUnknownFields = reverse (msg.oneofDescriptorProtoUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.oneofDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { oneofDescriptorProtoUnknownFields = reverse (msg.oneofDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { oneofDescriptorProtoName = (Just v)})
          2 -> do
            v <- decodeFieldMessage
            loop (msg { oneofDescriptorProtoOptions = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { oneofDescriptorProtoUnknownFields = (uf : msg.oneofDescriptorProtoUnknownFields)}))

-- | Field descriptors for 'OneofDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
oneofDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor OneofDescriptorProto)
oneofDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = oneofDescriptorProtoName
        , fdSet = \v m -> m { oneofDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 2
        , fdTypeDesc = MessageType "OneofOptions"
        , fdLabel = LabelOptional
        , fdGet = oneofDescriptorProtoOptions
        , fdSet = \v m -> m { oneofDescriptorProtoOptions = v }
        })
    ]

instance ProtoMessage OneofDescriptorProto where
  protoMessageName _ = "google.protobuf.OneofDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultOneofDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = oneofDescriptorProtoFieldDescriptors

instance IsMessage OneofDescriptorProto

instance Aeson.ToJSON OneofDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.oneofDescriptorProtoName
      , "options" .=: msg.oneofDescriptorProtoOptions
      ]

instance Aeson.FromJSON OneofDescriptorProto where
  parseJSON = Aeson.withObject "OneofDescriptorProto" $ \obj -> do
    fld_oneofDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_oneofDescriptorProtoOptions <- parseFieldMaybe obj "options"
    pure defaultOneofDescriptorProto
      { oneofDescriptorProtoName = maybe (oneofDescriptorProtoName defaultOneofDescriptorProto) id fld_oneofDescriptorProtoName
      , oneofDescriptorProtoOptions = maybe (oneofDescriptorProtoOptions defaultOneofDescriptorProto) id fld_oneofDescriptorProtoOptions
      }

instance Hashable OneofDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (salt) msg.oneofDescriptorProtoName) msg.oneofDescriptorProtoOptions

instance Proto.Extension.HasExtensions OneofDescriptorProto where
  messageUnknownFields = oneofDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { oneofDescriptorProtoUnknownFields = ufs }

instance Semigroup OneofDescriptorProto where
  a <> b = OneofDescriptorProto
    { oneofDescriptorProtoName = case b.oneofDescriptorProtoName of { Nothing -> a.oneofDescriptorProtoName; x -> x }
    , oneofDescriptorProtoOptions = case b.oneofDescriptorProtoOptions of { Nothing -> a.oneofDescriptorProtoOptions; x -> x }
    , oneofDescriptorProtoUnknownFields = a.oneofDescriptorProtoUnknownFields <> b.oneofDescriptorProtoUnknownFields
    }

instance Monoid OneofDescriptorProto where
  mempty = defaultOneofDescriptorProto

-- | Describes an enum type.
data EnumDescriptorProto = EnumDescriptorProto
  { enumDescriptorProtoName :: !(Maybe Text)
  , enumDescriptorProtoValue :: !(V.Vector EnumValueDescriptorProto)
  , enumDescriptorProtoOptions :: !(Maybe EnumOptions)
  , enumDescriptorProtoReservedRange :: !(V.Vector EnumDescriptorProto'EnumReservedRange)
    -- ^ Range of reserved numeric values. Reserved numeric values may not be used
    -- by enum values in the same enum declaration. Reserved ranges may not
    -- overlap.
  , enumDescriptorProtoReservedName :: !(V.Vector Text)
    -- ^ Reserved enum value names, which may not be reused. A given name may only
    -- be reserved once.
  , enumDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | Range of reserved numeric values. Reserved values may not be used by
-- entries in the same enum. Reserved ranges may not overlap.
-- 
-- Note that this is distinct from DescriptorProto.ReservedRange in that it
-- is inclusive such that it can appropriately represent the entire int32
-- domain.
data EnumDescriptorProto'EnumReservedRange = EnumDescriptorProto'EnumReservedRange
  { enumDescriptorProtoEnumReservedRangeStart :: !(Maybe Int32)
  , enumDescriptorProtoEnumReservedRangeEnd :: !(Maybe Int32)
  , enumDescriptorProtoEnumReservedRangeUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultEnumDescriptorProto'EnumReservedRange :: EnumDescriptorProto'EnumReservedRange
defaultEnumDescriptorProto'EnumReservedRange = EnumDescriptorProto'EnumReservedRange
  { enumDescriptorProtoEnumReservedRangeStart = Nothing
  , enumDescriptorProtoEnumReservedRangeEnd = Nothing
  , enumDescriptorProtoEnumReservedRangeUnknownFields = []
  }

instance MessageEncode EnumDescriptorProto'EnumReservedRange where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral v)) msg.enumDescriptorProtoEnumReservedRangeStart)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral v)) msg.enumDescriptorProtoEnumReservedRangeEnd)
    <> encodeUnknownFieldsSized msg.enumDescriptorProtoEnumReservedRangeUnknownFields

instance MessageDecode EnumDescriptorProto'EnumReservedRange where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultEnumDescriptorProto'EnumReservedRange
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_1 (msg { enumDescriptorProtoEnumReservedRangeStart = (Just v)}))
          (pure (case msg.enumDescriptorProtoEnumReservedRangeUnknownFields of { [] -> msg; _ -> msg { enumDescriptorProtoEnumReservedRangeUnknownFields = reverse (msg.enumDescriptorProtoEnumReservedRangeUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> loop (msg { enumDescriptorProtoEnumReservedRangeEnd = (Just v)}))
          (pure (case msg.enumDescriptorProtoEnumReservedRangeUnknownFields of { [] -> msg; _ -> msg { enumDescriptorProtoEnumReservedRangeUnknownFields = reverse (msg.enumDescriptorProtoEnumReservedRangeUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.enumDescriptorProtoEnumReservedRangeUnknownFields of { [] -> msg; _ -> msg { enumDescriptorProtoEnumReservedRangeUnknownFields = reverse (msg.enumDescriptorProtoEnumReservedRangeUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { enumDescriptorProtoEnumReservedRangeStart = (Just v)})
          2 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { enumDescriptorProtoEnumReservedRangeEnd = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { enumDescriptorProtoEnumReservedRangeUnknownFields = (uf : msg.enumDescriptorProtoEnumReservedRangeUnknownFields)}))

-- | Field descriptors for 'EnumDescriptorProto'EnumReservedRange', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
enumDescriptorProto'EnumReservedRangeFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor EnumDescriptorProto'EnumReservedRange)
enumDescriptorProto'EnumReservedRangeFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "start"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = enumDescriptorProtoEnumReservedRangeStart
        , fdSet = \v m -> m { enumDescriptorProtoEnumReservedRangeStart = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "end"
        , fdNumber = 2
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = enumDescriptorProtoEnumReservedRangeEnd
        , fdSet = \v m -> m { enumDescriptorProtoEnumReservedRangeEnd = v }
        })
    ]

instance ProtoMessage EnumDescriptorProto'EnumReservedRange where
  protoMessageName _ = "google.protobuf.EnumDescriptorProto.EnumReservedRange"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultEnumDescriptorProto'EnumReservedRange
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = enumDescriptorProto'EnumReservedRangeFieldDescriptors

instance IsMessage EnumDescriptorProto'EnumReservedRange

instance Aeson.ToJSON EnumDescriptorProto'EnumReservedRange where
  toJSON msg = jsonObject
      [ "start" .=: msg.enumDescriptorProtoEnumReservedRangeStart
      , "end" .=: msg.enumDescriptorProtoEnumReservedRangeEnd
      ]

instance Aeson.FromJSON EnumDescriptorProto'EnumReservedRange where
  parseJSON = Aeson.withObject "EnumDescriptorProto'EnumReservedRange" $ \obj -> do
    fld_enumDescriptorProtoEnumReservedRangeStart <- parseFieldMaybe obj "start"
    fld_enumDescriptorProtoEnumReservedRangeEnd <- parseFieldMaybe obj "end"
    pure defaultEnumDescriptorProto'EnumReservedRange
      { enumDescriptorProtoEnumReservedRangeStart = maybe (enumDescriptorProtoEnumReservedRangeStart defaultEnumDescriptorProto'EnumReservedRange) id fld_enumDescriptorProtoEnumReservedRangeStart
      , enumDescriptorProtoEnumReservedRangeEnd = maybe (enumDescriptorProtoEnumReservedRangeEnd defaultEnumDescriptorProto'EnumReservedRange) id fld_enumDescriptorProtoEnumReservedRangeEnd
      }

instance Hashable EnumDescriptorProto'EnumReservedRange where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (salt) msg.enumDescriptorProtoEnumReservedRangeStart) msg.enumDescriptorProtoEnumReservedRangeEnd

instance Proto.Extension.HasExtensions EnumDescriptorProto'EnumReservedRange where
  messageUnknownFields = enumDescriptorProtoEnumReservedRangeUnknownFields
  setMessageUnknownFields !ufs msg = msg { enumDescriptorProtoEnumReservedRangeUnknownFields = ufs }

instance Semigroup EnumDescriptorProto'EnumReservedRange where
  a <> b = EnumDescriptorProto'EnumReservedRange
    { enumDescriptorProtoEnumReservedRangeStart = case b.enumDescriptorProtoEnumReservedRangeStart of { Nothing -> a.enumDescriptorProtoEnumReservedRangeStart; x -> x }
    , enumDescriptorProtoEnumReservedRangeEnd = case b.enumDescriptorProtoEnumReservedRangeEnd of { Nothing -> a.enumDescriptorProtoEnumReservedRangeEnd; x -> x }
    , enumDescriptorProtoEnumReservedRangeUnknownFields = a.enumDescriptorProtoEnumReservedRangeUnknownFields <> b.enumDescriptorProtoEnumReservedRangeUnknownFields
    }

instance Monoid EnumDescriptorProto'EnumReservedRange where
  mempty = defaultEnumDescriptorProto'EnumReservedRange

defaultEnumDescriptorProto :: EnumDescriptorProto
defaultEnumDescriptorProto = EnumDescriptorProto
  { enumDescriptorProtoName = Nothing
  , enumDescriptorProtoValue = V.empty
  , enumDescriptorProtoOptions = Nothing
  , enumDescriptorProtoReservedRange = V.empty
  , enumDescriptorProtoReservedName = V.empty
  , enumDescriptorProtoUnknownFields = []
  }

instance MessageEncode EnumDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.enumDescriptorProtoName)
    <> V.foldl' (\acc v -> acc <> archSubmessage 18 (buildSized v)) mempty msg.enumDescriptorProtoValue
    <> (maybe mempty (\v -> archSubmessage 26 (buildSized v)) msg.enumDescriptorProtoOptions)
    <> V.foldl' (\acc v -> acc <> archSubmessage 34 (buildSized v)) mempty msg.enumDescriptorProtoReservedRange
    <> V.foldl' (\acc v -> acc <> archString 42 v) mempty msg.enumDescriptorProtoReservedName
    <> encodeUnknownFieldsSized msg.enumDescriptorProtoUnknownFields

instance MessageDecode EnumDescriptorProto where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultEnumDescriptorProto emptyGrowList emptyGrowList emptyGrowList
    where
      stage_0 msg gl_0 gl_1 gl_2 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { enumDescriptorProtoName = (Just v)}) gl_0 gl_1 gl_2)
          (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2)
      stage_1 msg gl_0 gl_1 gl_2 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_1 msg (snocGrowList gl_0 v) gl_1 gl_2)
          (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2)
      stage_2 msg gl_0 gl_1 gl_2 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_3 (msg { enumDescriptorProtoOptions = (Just v)}) gl_0 gl_1 gl_2)
          (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2)
      stage_3 msg gl_0 gl_1 gl_2 =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_3 msg gl_0 (snocGrowList gl_1 v) gl_2)
          (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2)
      stage_4 msg gl_0 gl_1 gl_2 =
        inOrderStage1
          (0x2a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_4 msg gl_0 gl_1 (snocGrowList gl_2 v))
          (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
          (loop msg gl_0 gl_1 gl_2)
      loop msg gl_0 gl_1 gl_2 = withTagM
        (pure (case msg.enumDescriptorProtoUnknownFields of { [] -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2 }; _ -> msg { enumDescriptorProtoValue = growListToVector gl_0, enumDescriptorProtoReservedRange = growListToVector gl_1, enumDescriptorProtoReservedName = growListToVector gl_2, enumDescriptorProtoUnknownFields = reverse (msg.enumDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { enumDescriptorProtoName = (Just v)}) gl_0 gl_1 gl_2
          2 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v) gl_1 gl_2
          3 -> do
            v <- decodeFieldMessage
            loop (msg { enumDescriptorProtoOptions = (Just v)}) gl_0 gl_1 gl_2
          4 -> do
            v <- decodeFieldMessage
            loop msg gl_0 (snocGrowList gl_1 v) gl_2
          5 -> do
            v <- decodeFieldString
            loop msg gl_0 gl_1 (snocGrowList gl_2 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { enumDescriptorProtoUnknownFields = (uf : msg.enumDescriptorProtoUnknownFields)}) gl_0 gl_1 gl_2)

-- | Field descriptors for 'EnumDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
enumDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor EnumDescriptorProto)
enumDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = enumDescriptorProtoName
        , fdSet = \v m -> m { enumDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "value"
        , fdNumber = 2
        , fdTypeDesc = MessageType "EnumValueDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = enumDescriptorProtoValue
        , fdSet = \v m -> m { enumDescriptorProtoValue = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 3
        , fdTypeDesc = MessageType "EnumOptions"
        , fdLabel = LabelOptional
        , fdGet = enumDescriptorProtoOptions
        , fdSet = \v m -> m { enumDescriptorProtoOptions = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "reserved_range"
        , fdNumber = 4
        , fdTypeDesc = MessageType "EnumReservedRange"
        , fdLabel = LabelRepeated
        , fdGet = enumDescriptorProtoReservedRange
        , fdSet = \v m -> m { enumDescriptorProtoReservedRange = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "reserved_name"
        , fdNumber = 5
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelRepeated
        , fdGet = enumDescriptorProtoReservedName
        , fdSet = \v m -> m { enumDescriptorProtoReservedName = v }
        })
    ]

instance ProtoMessage EnumDescriptorProto where
  protoMessageName _ = "google.protobuf.EnumDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultEnumDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = enumDescriptorProtoFieldDescriptors

instance IsMessage EnumDescriptorProto

instance Aeson.ToJSON EnumDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.enumDescriptorProtoName
      , "value" .=: msg.enumDescriptorProtoValue
      , "options" .=: msg.enumDescriptorProtoOptions
      , "reservedRange" .=: msg.enumDescriptorProtoReservedRange
      , "reservedName" .=: msg.enumDescriptorProtoReservedName
      ]

instance Aeson.FromJSON EnumDescriptorProto where
  parseJSON = Aeson.withObject "EnumDescriptorProto" $ \obj -> do
    fld_enumDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_enumDescriptorProtoValue <- parseFieldMaybe obj "value"
    fld_enumDescriptorProtoOptions <- parseFieldMaybe obj "options"
    fld_enumDescriptorProtoReservedRange <- parseFieldMaybe obj "reservedRange"
    fld_enumDescriptorProtoReservedName <- parseFieldMaybe obj "reservedName"
    pure defaultEnumDescriptorProto
      { enumDescriptorProtoName = maybe (enumDescriptorProtoName defaultEnumDescriptorProto) id fld_enumDescriptorProtoName
      , enumDescriptorProtoValue = maybe (enumDescriptorProtoValue defaultEnumDescriptorProto) id fld_enumDescriptorProtoValue
      , enumDescriptorProtoOptions = maybe (enumDescriptorProtoOptions defaultEnumDescriptorProto) id fld_enumDescriptorProtoOptions
      , enumDescriptorProtoReservedRange = maybe (enumDescriptorProtoReservedRange defaultEnumDescriptorProto) id fld_enumDescriptorProtoReservedRange
      , enumDescriptorProtoReservedName = maybe (enumDescriptorProtoReservedName defaultEnumDescriptorProto) id fld_enumDescriptorProtoReservedName
      }

instance Hashable EnumDescriptorProto where
  hashWithSalt salt msg = V.foldl' hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (salt) msg.enumDescriptorProtoName) msg.enumDescriptorProtoValue) msg.enumDescriptorProtoOptions) msg.enumDescriptorProtoReservedRange) msg.enumDescriptorProtoReservedName

instance Proto.Extension.HasExtensions EnumDescriptorProto where
  messageUnknownFields = enumDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { enumDescriptorProtoUnknownFields = ufs }

instance Semigroup EnumDescriptorProto where
  a <> b = EnumDescriptorProto
    { enumDescriptorProtoName = case b.enumDescriptorProtoName of { Nothing -> a.enumDescriptorProtoName; x -> x }
    , enumDescriptorProtoValue = a.enumDescriptorProtoValue <> b.enumDescriptorProtoValue
    , enumDescriptorProtoOptions = case b.enumDescriptorProtoOptions of { Nothing -> a.enumDescriptorProtoOptions; x -> x }
    , enumDescriptorProtoReservedRange = a.enumDescriptorProtoReservedRange <> b.enumDescriptorProtoReservedRange
    , enumDescriptorProtoReservedName = a.enumDescriptorProtoReservedName <> b.enumDescriptorProtoReservedName
    , enumDescriptorProtoUnknownFields = a.enumDescriptorProtoUnknownFields <> b.enumDescriptorProtoUnknownFields
    }

instance Monoid EnumDescriptorProto where
  mempty = defaultEnumDescriptorProto

-- | Describes a value within an enum.
data EnumValueDescriptorProto = EnumValueDescriptorProto
  { enumValueDescriptorProtoName :: !(Maybe Text)
  , enumValueDescriptorProtoNumber :: !(Maybe Int32)
  , enumValueDescriptorProtoOptions :: !(Maybe EnumValueOptions)
  , enumValueDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultEnumValueDescriptorProto :: EnumValueDescriptorProto
defaultEnumValueDescriptorProto = EnumValueDescriptorProto
  { enumValueDescriptorProtoName = Nothing
  , enumValueDescriptorProtoNumber = Nothing
  , enumValueDescriptorProtoOptions = Nothing
  , enumValueDescriptorProtoUnknownFields = []
  }

instance MessageEncode EnumValueDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.enumValueDescriptorProtoName)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral v)) msg.enumValueDescriptorProtoNumber)
    <> (maybe mempty (\v -> archSubmessage 26 (buildSized v)) msg.enumValueDescriptorProtoOptions)
    <> encodeUnknownFieldsSized msg.enumValueDescriptorProtoUnknownFields

instance MessageDecode EnumValueDescriptorProto where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultEnumValueDescriptorProto
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { enumValueDescriptorProtoName = (Just v)}))
          (pure (case msg.enumValueDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { enumValueDescriptorProtoUnknownFields = reverse (msg.enumValueDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_2 (msg { enumValueDescriptorProtoNumber = (Just v)}))
          (pure (case msg.enumValueDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { enumValueDescriptorProtoUnknownFields = reverse (msg.enumValueDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { enumValueDescriptorProtoOptions = (Just v)}))
          (pure (case msg.enumValueDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { enumValueDescriptorProtoUnknownFields = reverse (msg.enumValueDescriptorProtoUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.enumValueDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { enumValueDescriptorProtoUnknownFields = reverse (msg.enumValueDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { enumValueDescriptorProtoName = (Just v)})
          2 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { enumValueDescriptorProtoNumber = (Just v)})
          3 -> do
            v <- decodeFieldMessage
            loop (msg { enumValueDescriptorProtoOptions = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { enumValueDescriptorProtoUnknownFields = (uf : msg.enumValueDescriptorProtoUnknownFields)}))

-- | Field descriptors for 'EnumValueDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
enumValueDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor EnumValueDescriptorProto)
enumValueDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = enumValueDescriptorProtoName
        , fdSet = \v m -> m { enumValueDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "number"
        , fdNumber = 2
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = enumValueDescriptorProtoNumber
        , fdSet = \v m -> m { enumValueDescriptorProtoNumber = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 3
        , fdTypeDesc = MessageType "EnumValueOptions"
        , fdLabel = LabelOptional
        , fdGet = enumValueDescriptorProtoOptions
        , fdSet = \v m -> m { enumValueDescriptorProtoOptions = v }
        })
    ]

instance ProtoMessage EnumValueDescriptorProto where
  protoMessageName _ = "google.protobuf.EnumValueDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultEnumValueDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = enumValueDescriptorProtoFieldDescriptors

instance IsMessage EnumValueDescriptorProto

instance Aeson.ToJSON EnumValueDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.enumValueDescriptorProtoName
      , "number" .=: msg.enumValueDescriptorProtoNumber
      , "options" .=: msg.enumValueDescriptorProtoOptions
      ]

instance Aeson.FromJSON EnumValueDescriptorProto where
  parseJSON = Aeson.withObject "EnumValueDescriptorProto" $ \obj -> do
    fld_enumValueDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_enumValueDescriptorProtoNumber <- parseFieldMaybe obj "number"
    fld_enumValueDescriptorProtoOptions <- parseFieldMaybe obj "options"
    pure defaultEnumValueDescriptorProto
      { enumValueDescriptorProtoName = maybe (enumValueDescriptorProtoName defaultEnumValueDescriptorProto) id fld_enumValueDescriptorProtoName
      , enumValueDescriptorProtoNumber = maybe (enumValueDescriptorProtoNumber defaultEnumValueDescriptorProto) id fld_enumValueDescriptorProtoNumber
      , enumValueDescriptorProtoOptions = maybe (enumValueDescriptorProtoOptions defaultEnumValueDescriptorProto) id fld_enumValueDescriptorProtoOptions
      }

instance Hashable EnumValueDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.enumValueDescriptorProtoName) msg.enumValueDescriptorProtoNumber) msg.enumValueDescriptorProtoOptions

instance Proto.Extension.HasExtensions EnumValueDescriptorProto where
  messageUnknownFields = enumValueDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { enumValueDescriptorProtoUnknownFields = ufs }

instance Semigroup EnumValueDescriptorProto where
  a <> b = EnumValueDescriptorProto
    { enumValueDescriptorProtoName = case b.enumValueDescriptorProtoName of { Nothing -> a.enumValueDescriptorProtoName; x -> x }
    , enumValueDescriptorProtoNumber = case b.enumValueDescriptorProtoNumber of { Nothing -> a.enumValueDescriptorProtoNumber; x -> x }
    , enumValueDescriptorProtoOptions = case b.enumValueDescriptorProtoOptions of { Nothing -> a.enumValueDescriptorProtoOptions; x -> x }
    , enumValueDescriptorProtoUnknownFields = a.enumValueDescriptorProtoUnknownFields <> b.enumValueDescriptorProtoUnknownFields
    }

instance Monoid EnumValueDescriptorProto where
  mempty = defaultEnumValueDescriptorProto

-- | Describes a service.
data ServiceDescriptorProto = ServiceDescriptorProto
  { serviceDescriptorProtoName :: !(Maybe Text)
  , serviceDescriptorProtoMethod :: !(V.Vector MethodDescriptorProto)
  , serviceDescriptorProtoOptions :: !(Maybe ServiceOptions)
  , serviceDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultServiceDescriptorProto :: ServiceDescriptorProto
defaultServiceDescriptorProto = ServiceDescriptorProto
  { serviceDescriptorProtoName = Nothing
  , serviceDescriptorProtoMethod = V.empty
  , serviceDescriptorProtoOptions = Nothing
  , serviceDescriptorProtoUnknownFields = []
  }

instance MessageEncode ServiceDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.serviceDescriptorProtoName)
    <> V.foldl' (\acc v -> acc <> archSubmessage 18 (buildSized v)) mempty msg.serviceDescriptorProtoMethod
    <> (maybe mempty (\v -> archSubmessage 26 (buildSized v)) msg.serviceDescriptorProtoOptions)
    <> encodeUnknownFieldsSized msg.serviceDescriptorProtoUnknownFields

instance MessageDecode ServiceDescriptorProto where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultServiceDescriptorProto emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { serviceDescriptorProtoName = (Just v)}) gl_0)
          (pure (case msg.serviceDescriptorProtoUnknownFields of { [] -> msg { serviceDescriptorProtoMethod = growListToVector gl_0 }; _ -> msg { serviceDescriptorProtoMethod = growListToVector gl_0, serviceDescriptorProtoUnknownFields = reverse (msg.serviceDescriptorProtoUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_1 msg (snocGrowList gl_0 v))
          (pure (case msg.serviceDescriptorProtoUnknownFields of { [] -> msg { serviceDescriptorProtoMethod = growListToVector gl_0 }; _ -> msg { serviceDescriptorProtoMethod = growListToVector gl_0, serviceDescriptorProtoUnknownFields = reverse (msg.serviceDescriptorProtoUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { serviceDescriptorProtoOptions = (Just v)}) gl_0)
          (pure (case msg.serviceDescriptorProtoUnknownFields of { [] -> msg { serviceDescriptorProtoMethod = growListToVector gl_0 }; _ -> msg { serviceDescriptorProtoMethod = growListToVector gl_0, serviceDescriptorProtoUnknownFields = reverse (msg.serviceDescriptorProtoUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.serviceDescriptorProtoUnknownFields of { [] -> msg { serviceDescriptorProtoMethod = growListToVector gl_0 }; _ -> msg { serviceDescriptorProtoMethod = growListToVector gl_0, serviceDescriptorProtoUnknownFields = reverse (msg.serviceDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { serviceDescriptorProtoName = (Just v)}) gl_0
          2 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          3 -> do
            v <- decodeFieldMessage
            loop (msg { serviceDescriptorProtoOptions = (Just v)}) gl_0
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { serviceDescriptorProtoUnknownFields = (uf : msg.serviceDescriptorProtoUnknownFields)}) gl_0)

-- | Field descriptors for 'ServiceDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
serviceDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor ServiceDescriptorProto)
serviceDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = serviceDescriptorProtoName
        , fdSet = \v m -> m { serviceDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "method"
        , fdNumber = 2
        , fdTypeDesc = MessageType "MethodDescriptorProto"
        , fdLabel = LabelRepeated
        , fdGet = serviceDescriptorProtoMethod
        , fdSet = \v m -> m { serviceDescriptorProtoMethod = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 3
        , fdTypeDesc = MessageType "ServiceOptions"
        , fdLabel = LabelOptional
        , fdGet = serviceDescriptorProtoOptions
        , fdSet = \v m -> m { serviceDescriptorProtoOptions = v }
        })
    ]

instance ProtoMessage ServiceDescriptorProto where
  protoMessageName _ = "google.protobuf.ServiceDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultServiceDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = serviceDescriptorProtoFieldDescriptors

instance IsMessage ServiceDescriptorProto

instance Aeson.ToJSON ServiceDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.serviceDescriptorProtoName
      , "method" .=: msg.serviceDescriptorProtoMethod
      , "options" .=: msg.serviceDescriptorProtoOptions
      ]

instance Aeson.FromJSON ServiceDescriptorProto where
  parseJSON = Aeson.withObject "ServiceDescriptorProto" $ \obj -> do
    fld_serviceDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_serviceDescriptorProtoMethod <- parseFieldMaybe obj "method"
    fld_serviceDescriptorProtoOptions <- parseFieldMaybe obj "options"
    pure defaultServiceDescriptorProto
      { serviceDescriptorProtoName = maybe (serviceDescriptorProtoName defaultServiceDescriptorProto) id fld_serviceDescriptorProtoName
      , serviceDescriptorProtoMethod = maybe (serviceDescriptorProtoMethod defaultServiceDescriptorProto) id fld_serviceDescriptorProtoMethod
      , serviceDescriptorProtoOptions = maybe (serviceDescriptorProtoOptions defaultServiceDescriptorProto) id fld_serviceDescriptorProtoOptions
      }

instance Hashable ServiceDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (salt) msg.serviceDescriptorProtoName) msg.serviceDescriptorProtoMethod) msg.serviceDescriptorProtoOptions

instance Proto.Extension.HasExtensions ServiceDescriptorProto where
  messageUnknownFields = serviceDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { serviceDescriptorProtoUnknownFields = ufs }

instance Semigroup ServiceDescriptorProto where
  a <> b = ServiceDescriptorProto
    { serviceDescriptorProtoName = case b.serviceDescriptorProtoName of { Nothing -> a.serviceDescriptorProtoName; x -> x }
    , serviceDescriptorProtoMethod = a.serviceDescriptorProtoMethod <> b.serviceDescriptorProtoMethod
    , serviceDescriptorProtoOptions = case b.serviceDescriptorProtoOptions of { Nothing -> a.serviceDescriptorProtoOptions; x -> x }
    , serviceDescriptorProtoUnknownFields = a.serviceDescriptorProtoUnknownFields <> b.serviceDescriptorProtoUnknownFields
    }

instance Monoid ServiceDescriptorProto where
  mempty = defaultServiceDescriptorProto

-- | Describes a method of a service.
data MethodDescriptorProto = MethodDescriptorProto
  { methodDescriptorProtoName :: !(Maybe Text)
  , methodDescriptorProtoInputType :: !(Maybe Text)
    -- ^ Input and output type names.  These are resolved in the same way as
    -- FieldDescriptorProto.type_name, but must refer to a message type.
  , methodDescriptorProtoOutputType :: !(Maybe Text)
  , methodDescriptorProtoOptions :: !(Maybe MethodOptions)
  , methodDescriptorProtoClientStreaming :: !(Maybe Bool)
    -- ^ Identifies if client streams multiple client messages
  , methodDescriptorProtoServerStreaming :: !(Maybe Bool)
    -- ^ Identifies if server streams multiple server messages
  , methodDescriptorProtoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultMethodDescriptorProto :: MethodDescriptorProto
defaultMethodDescriptorProto = MethodDescriptorProto
  { methodDescriptorProtoName = Nothing
  , methodDescriptorProtoInputType = Nothing
  , methodDescriptorProtoOutputType = Nothing
  , methodDescriptorProtoOptions = Nothing
  , methodDescriptorProtoClientStreaming = Nothing
  , methodDescriptorProtoServerStreaming = Nothing
  , methodDescriptorProtoUnknownFields = []
  }

instance MessageEncode MethodDescriptorProto where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.methodDescriptorProtoName)
    <> (maybe mempty (\v -> archString 18 v) msg.methodDescriptorProtoInputType)
    <> (maybe mempty (\v -> archString 26 v) msg.methodDescriptorProtoOutputType)
    <> (maybe mempty (\v -> archSubmessage 34 (buildSized v)) msg.methodDescriptorProtoOptions)
    <> (maybe mempty (\v -> archBool 40 v) msg.methodDescriptorProtoClientStreaming)
    <> (maybe mempty (\v -> archBool 48 v) msg.methodDescriptorProtoServerStreaming)
    <> encodeUnknownFieldsSized msg.methodDescriptorProtoUnknownFields

instance MessageDecode MethodDescriptorProto where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultMethodDescriptorProto
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { methodDescriptorProtoName = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { methodDescriptorProtoInputType = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_3 (msg { methodDescriptorProtoOutputType = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_4 (msg { methodDescriptorProtoOptions = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_4 msg =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_5 (msg { methodDescriptorProtoClientStreaming = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      stage_5 msg =
        inOrderStage1
          (0x30 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> loop (msg { methodDescriptorProtoServerStreaming = (Just v)}))
          (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.methodDescriptorProtoUnknownFields of { [] -> msg; _ -> msg { methodDescriptorProtoUnknownFields = reverse (msg.methodDescriptorProtoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { methodDescriptorProtoName = (Just v)})
          2 -> do
            v <- decodeFieldString
            loop (msg { methodDescriptorProtoInputType = (Just v)})
          3 -> do
            v <- decodeFieldString
            loop (msg { methodDescriptorProtoOutputType = (Just v)})
          4 -> do
            v <- decodeFieldMessage
            loop (msg { methodDescriptorProtoOptions = (Just v)})
          5 -> do
            v <- decodeFieldBool
            loop (msg { methodDescriptorProtoClientStreaming = (Just v)})
          6 -> do
            v <- decodeFieldBool
            loop (msg { methodDescriptorProtoServerStreaming = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { methodDescriptorProtoUnknownFields = (uf : msg.methodDescriptorProtoUnknownFields)}))

-- | Field descriptors for 'MethodDescriptorProto', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
methodDescriptorProtoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor MethodDescriptorProto)
methodDescriptorProtoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoName
        , fdSet = \v m -> m { methodDescriptorProtoName = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "input_type"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoInputType
        , fdSet = \v m -> m { methodDescriptorProtoInputType = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "output_type"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoOutputType
        , fdSet = \v m -> m { methodDescriptorProtoOutputType = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "options"
        , fdNumber = 4
        , fdTypeDesc = MessageType "MethodOptions"
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoOptions
        , fdSet = \v m -> m { methodDescriptorProtoOptions = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "client_streaming"
        , fdNumber = 5
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoClientStreaming
        , fdSet = \v m -> m { methodDescriptorProtoClientStreaming = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "server_streaming"
        , fdNumber = 6
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = methodDescriptorProtoServerStreaming
        , fdSet = \v m -> m { methodDescriptorProtoServerStreaming = v }
        })
    ]

instance ProtoMessage MethodDescriptorProto where
  protoMessageName _ = "google.protobuf.MethodDescriptorProto"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultMethodDescriptorProto
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = methodDescriptorProtoFieldDescriptors

instance IsMessage MethodDescriptorProto

instance Aeson.ToJSON MethodDescriptorProto where
  toJSON msg = jsonObject
      [ "name" .=: msg.methodDescriptorProtoName
      , "inputType" .=: msg.methodDescriptorProtoInputType
      , "outputType" .=: msg.methodDescriptorProtoOutputType
      , "options" .=: msg.methodDescriptorProtoOptions
      , "clientStreaming" .=: msg.methodDescriptorProtoClientStreaming
      , "serverStreaming" .=: msg.methodDescriptorProtoServerStreaming
      ]

instance Aeson.FromJSON MethodDescriptorProto where
  parseJSON = Aeson.withObject "MethodDescriptorProto" $ \obj -> do
    fld_methodDescriptorProtoName <- parseFieldMaybe obj "name"
    fld_methodDescriptorProtoInputType <- parseFieldMaybe obj "inputType"
    fld_methodDescriptorProtoOutputType <- parseFieldMaybe obj "outputType"
    fld_methodDescriptorProtoOptions <- parseFieldMaybe obj "options"
    fld_methodDescriptorProtoClientStreaming <- parseFieldMaybe obj "clientStreaming"
    fld_methodDescriptorProtoServerStreaming <- parseFieldMaybe obj "serverStreaming"
    pure defaultMethodDescriptorProto
      { methodDescriptorProtoName = maybe (methodDescriptorProtoName defaultMethodDescriptorProto) id fld_methodDescriptorProtoName
      , methodDescriptorProtoInputType = maybe (methodDescriptorProtoInputType defaultMethodDescriptorProto) id fld_methodDescriptorProtoInputType
      , methodDescriptorProtoOutputType = maybe (methodDescriptorProtoOutputType defaultMethodDescriptorProto) id fld_methodDescriptorProtoOutputType
      , methodDescriptorProtoOptions = maybe (methodDescriptorProtoOptions defaultMethodDescriptorProto) id fld_methodDescriptorProtoOptions
      , methodDescriptorProtoClientStreaming = maybe (methodDescriptorProtoClientStreaming defaultMethodDescriptorProto) id fld_methodDescriptorProtoClientStreaming
      , methodDescriptorProtoServerStreaming = maybe (methodDescriptorProtoServerStreaming defaultMethodDescriptorProto) id fld_methodDescriptorProtoServerStreaming
      }

instance Hashable MethodDescriptorProto where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.methodDescriptorProtoName) msg.methodDescriptorProtoInputType) msg.methodDescriptorProtoOutputType) msg.methodDescriptorProtoOptions) msg.methodDescriptorProtoClientStreaming) msg.methodDescriptorProtoServerStreaming

instance Proto.Extension.HasExtensions MethodDescriptorProto where
  messageUnknownFields = methodDescriptorProtoUnknownFields
  setMessageUnknownFields !ufs msg = msg { methodDescriptorProtoUnknownFields = ufs }

instance Semigroup MethodDescriptorProto where
  a <> b = MethodDescriptorProto
    { methodDescriptorProtoName = case b.methodDescriptorProtoName of { Nothing -> a.methodDescriptorProtoName; x -> x }
    , methodDescriptorProtoInputType = case b.methodDescriptorProtoInputType of { Nothing -> a.methodDescriptorProtoInputType; x -> x }
    , methodDescriptorProtoOutputType = case b.methodDescriptorProtoOutputType of { Nothing -> a.methodDescriptorProtoOutputType; x -> x }
    , methodDescriptorProtoOptions = case b.methodDescriptorProtoOptions of { Nothing -> a.methodDescriptorProtoOptions; x -> x }
    , methodDescriptorProtoClientStreaming = case b.methodDescriptorProtoClientStreaming of { Nothing -> a.methodDescriptorProtoClientStreaming; x -> x }
    , methodDescriptorProtoServerStreaming = case b.methodDescriptorProtoServerStreaming of { Nothing -> a.methodDescriptorProtoServerStreaming; x -> x }
    , methodDescriptorProtoUnknownFields = a.methodDescriptorProtoUnknownFields <> b.methodDescriptorProtoUnknownFields
    }

instance Monoid MethodDescriptorProto where
  mempty = defaultMethodDescriptorProto

-- | ===================================================================
-- Options
-- Each of the definitions above may have "options" attached.  These are
-- just annotations which may cause code to be generated slightly differently
-- or may contain hints for code that manipulates protocol messages.
-- 
-- Clients may define custom options as extensions of the *Options messages.
-- These extensions may not yet be known at parsing time, so the parser cannot
-- store the values in them.  Instead it stores them in a field in the *Options
-- message called uninterpreted_option. This field must have the same name
-- across all *Options messages. We then use this field to populate the
-- extensions when we build a descriptor, at which point all protos have been
-- parsed and so all extensions are known.
-- 
-- Extension numbers for custom options may be chosen as follows:
-- * For options which will only be used within a single application or
--   organization, or for experimental options, use field numbers 50000
--   through 99999.  It is up to you to ensure that you do not use the
--   same number for multiple options.
-- * For options which will be published and used publicly by multiple
--   independent entities, e-mail protobuf-global-extension-registry@google.com
--   to reserve extension numbers. Simply provide your project name (e.g.
--   Objective-C plugin) and your project website (if available) -- there's no
--   need to explain how you intend to use them. Usually you only need one
--   extension number. You can declare multiple options with only one extension
--   number by putting them in a sub-message. See the Custom Options section of
--   the docs for examples:
--   https://developers.google.com/protocol-buffers/docs/proto#options
--   If this turns out to be popular, a web service will be set up
--   to automatically assign option numbers.
data FileOptions = FileOptions
  { fileOptionsJavaPackage :: !(Maybe Text)
    -- ^ Sets the Java package where classes generated from this .proto will be
    -- placed.  By default, the proto package is used, but this is often
    -- inappropriate because proto packages do not normally start with backwards
    -- domain names.
  , fileOptionsJavaOuterClassname :: !(Maybe Text)
    -- ^ Controls the name of the wrapper Java class generated for the .proto file.
    -- That class will always contain the .proto file's getDescriptor() method as
    -- well as any top-level extensions defined in the .proto file.
    -- If java_multiple_files is disabled, then all the other classes from the
    -- .proto file will be nested inside the single wrapper outer class.
  , fileOptionsJavaMultipleFiles :: !(Maybe Bool)
    -- ^ If enabled, then the Java code generator will generate a separate .java
    -- file for each top-level message, enum, and service defined in the .proto
    -- file.  Thus, these types will *not* be nested inside the wrapper class
    -- named by java_outer_classname.  However, the wrapper class will still be
    -- generated to contain the file's getDescriptor() method as well as any
    -- top-level extensions defined in the file.
  , fileOptionsJavaGenerateEqualsAndHash :: !(Maybe Bool)
    -- ^ This option does nothing.
  , fileOptionsJavaStringCheckUtf8 :: !(Maybe Bool)
    -- ^ A proto2 file can set this to true to opt in to UTF-8 checking for Java,
    -- which will throw an exception if invalid UTF-8 is parsed from the wire or
    -- assigned to a string field.
    -- 
    -- TODO: clarify exactly what kinds of field types this option
    -- applies to, and update these docs accordingly.
    -- 
    -- Proto3 files already perform these checks. Setting the option explicitly to
    -- false has no effect: it cannot be used to opt proto3 files out of UTF-8
    -- checks.
  , fileOptionsOptimizeFor :: !(Maybe FileOptions'OptimizeMode)
  , fileOptionsGoPackage :: !(Maybe Text)
    -- ^ Sets the Go package where structs generated from this .proto will be
    -- placed. If omitted, the Go package will be derived from the following:
    --   - The basename of the package import path, if provided.
    --   - Otherwise, the package statement in the .proto file, if present.
    --   - Otherwise, the basename of the .proto file, without extension.
  , fileOptionsCcGenericServices :: !(Maybe Bool)
    -- ^ Should generic services be generated in each language?  "Generic" services
    -- are not specific to any particular RPC system.  They are generated by the
    -- main code generators in each language (without additional plugins).
    -- Generic services were the only kind of service generation supported by
    -- early versions of google.protobuf.
    -- 
    -- Generic services are now considered deprecated in favor of using plugins
    -- that generate code specific to your particular RPC system.  Therefore,
    -- these default to false.  Old code which depends on generic services should
    -- explicitly set them to true.
  , fileOptionsJavaGenericServices :: !(Maybe Bool)
  , fileOptionsPyGenericServices :: !(Maybe Bool)
  , fileOptionsDeprecated :: !(Maybe Bool)
    -- ^ Is this file deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for everything in the file, or it will be completely ignored; in the very
    -- least, this is a formalization for deprecating files.
  , fileOptionsCcEnableArenas :: !(Maybe Bool)
    -- ^ Enables the use of arenas for the proto messages in this file. This applies
    -- only to generated classes for C++.
  , fileOptionsObjcClassPrefix :: !(Maybe Text)
    -- ^ Sets the objective c class prefix which is prepended to all objective c
    -- generated classes from this .proto. There is no default.
  , fileOptionsCsharpNamespace :: !(Maybe Text)
    -- ^ Namespace for generated classes; defaults to the package.
  , fileOptionsSwiftPrefix :: !(Maybe Text)
    -- ^ By default Swift generators will take the proto package and CamelCase it
    -- replacing '.' with underscore and use that to prefix the types/symbols
    -- defined. When this options is provided, they will use this value instead
    -- to prefix the types/symbols defined.
  , fileOptionsPhpClassPrefix :: !(Maybe Text)
    -- ^ Sets the php class prefix which is prepended to all php generated classes
    -- from this .proto. Default is empty.
  , fileOptionsPhpNamespace :: !(Maybe Text)
    -- ^ Use this option to change the namespace of php generated classes. Default
    -- is empty. When this option is empty, the package name will be used for
    -- determining the namespace.
  , fileOptionsPhpMetadataNamespace :: !(Maybe Text)
    -- ^ Use this option to change the namespace of php generated metadata classes.
    -- Default is empty. When this option is empty, the proto file name will be
    -- used for determining the namespace.
  , fileOptionsRubyPackage :: !(Maybe Text)
    -- ^ Use this option to change the package of ruby generated classes. Default
    -- is empty. When this option is not set, the package name will be used for
    -- determining the ruby package.
  , fileOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , fileOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here.
    -- See the documentation for the "Options" section above.
  , fileOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | Generated classes can be optimized for speed or code size.
data FileOptions'OptimizeMode
  = FileOptions'OptimizeMode'Speed
  | FileOptions'OptimizeMode'CodeSize
    -- ^ etc.
  | FileOptions'OptimizeMode'LiteRuntime
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFileOptions'OptimizeMode :: FileOptions'OptimizeMode -> Int
toProtoEnumFileOptions'OptimizeMode FileOptions'OptimizeMode'Speed = 1
toProtoEnumFileOptions'OptimizeMode FileOptions'OptimizeMode'CodeSize = 2
toProtoEnumFileOptions'OptimizeMode FileOptions'OptimizeMode'LiteRuntime = 3

fromProtoEnumFileOptions'OptimizeMode :: Int -> Maybe FileOptions'OptimizeMode
fromProtoEnumFileOptions'OptimizeMode 1 = Just FileOptions'OptimizeMode'Speed
fromProtoEnumFileOptions'OptimizeMode 2 = Just FileOptions'OptimizeMode'CodeSize
fromProtoEnumFileOptions'OptimizeMode 3 = Just FileOptions'OptimizeMode'LiteRuntime
fromProtoEnumFileOptions'OptimizeMode _ = Nothing

instance MessageEncode FileOptions'OptimizeMode where
  buildSized _ = mempty
instance MessageDecode FileOptions'OptimizeMode where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FileOptions'OptimizeMode where
  toJSON FileOptions'OptimizeMode'Speed = Aeson.String "SPEED"
  toJSON FileOptions'OptimizeMode'CodeSize = Aeson.String "CODE_SIZE"
  toJSON FileOptions'OptimizeMode'LiteRuntime = Aeson.String "LITE_RUNTIME"

instance Aeson.FromJSON FileOptions'OptimizeMode where
  parseJSON = \case
    Aeson.String "SPEED" -> pure FileOptions'OptimizeMode'Speed
    Aeson.String "CODE_SIZE" -> pure FileOptions'OptimizeMode'CodeSize
    Aeson.String "LITE_RUNTIME" -> pure FileOptions'OptimizeMode'LiteRuntime
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FileOptions'OptimizeMode"

instance Hashable FileOptions'OptimizeMode where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFileOptions'OptimizeMode x)

defaultFileOptions :: FileOptions
defaultFileOptions = FileOptions
  { fileOptionsJavaPackage = Nothing
  , fileOptionsJavaOuterClassname = Nothing
  , fileOptionsJavaMultipleFiles = Nothing
  , fileOptionsJavaGenerateEqualsAndHash = Nothing
  , fileOptionsJavaStringCheckUtf8 = Nothing
  , fileOptionsOptimizeFor = Nothing
  , fileOptionsGoPackage = Nothing
  , fileOptionsCcGenericServices = Nothing
  , fileOptionsJavaGenericServices = Nothing
  , fileOptionsPyGenericServices = Nothing
  , fileOptionsDeprecated = Nothing
  , fileOptionsCcEnableArenas = Nothing
  , fileOptionsObjcClassPrefix = Nothing
  , fileOptionsCsharpNamespace = Nothing
  , fileOptionsSwiftPrefix = Nothing
  , fileOptionsPhpClassPrefix = Nothing
  , fileOptionsPhpNamespace = Nothing
  , fileOptionsPhpMetadataNamespace = Nothing
  , fileOptionsRubyPackage = Nothing
  , fileOptionsFeatures = Nothing
  , fileOptionsUninterpretedOption = V.empty
  , fileOptionsUnknownFields = []
  }

instance MessageEncode FileOptions where
  buildSized msg =
    (maybe mempty (\v -> archString 10 v) msg.fileOptionsJavaPackage)
    <> (maybe mempty (\v -> archString 66 v) msg.fileOptionsJavaOuterClassname)
    <> (maybe mempty (\v -> archBool 80 v) msg.fileOptionsJavaMultipleFiles)
    <> (maybe mempty (\v -> archBool 160 v) msg.fileOptionsJavaGenerateEqualsAndHash)
    <> (maybe mempty (\v -> archBool 216 v) msg.fileOptionsJavaStringCheckUtf8)
    <> (maybe mempty (\v -> archVarint 72 (fromIntegral (toProtoEnumFileOptions'OptimizeMode v))) msg.fileOptionsOptimizeFor)
    <> (maybe mempty (\v -> archString 90 v) msg.fileOptionsGoPackage)
    <> (maybe mempty (\v -> archBool 128 v) msg.fileOptionsCcGenericServices)
    <> (maybe mempty (\v -> archBool 136 v) msg.fileOptionsJavaGenericServices)
    <> (maybe mempty (\v -> archBool 144 v) msg.fileOptionsPyGenericServices)
    <> (maybe mempty (\v -> archBool 184 v) msg.fileOptionsDeprecated)
    <> (maybe mempty (\v -> archBool 248 v) msg.fileOptionsCcEnableArenas)
    <> (maybe mempty (\v -> archString 290 v) msg.fileOptionsObjcClassPrefix)
    <> (maybe mempty (\v -> archString 298 v) msg.fileOptionsCsharpNamespace)
    <> (maybe mempty (\v -> archString 314 v) msg.fileOptionsSwiftPrefix)
    <> (maybe mempty (\v -> archString 322 v) msg.fileOptionsPhpClassPrefix)
    <> (maybe mempty (\v -> archString 330 v) msg.fileOptionsPhpNamespace)
    <> (maybe mempty (\v -> archString 354 v) msg.fileOptionsPhpMetadataNamespace)
    <> (maybe mempty (\v -> archString 362 v) msg.fileOptionsRubyPackage)
    <> (maybe mempty (\v -> archSubmessage 402 (buildSized v)) msg.fileOptionsFeatures)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.fileOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.fileOptionsUnknownFields

instance MessageDecode FileOptions where
  messageDecoder = stage_0 defaultFileOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { fileOptionsJavaPackage = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x42 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { fileOptionsJavaOuterClassname = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x50 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_3 (msg { fileOptionsJavaMultipleFiles = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage
          0x1a0
          0xffff
          2
          decodeFieldBool
          (\v -> stage_4 (msg { fileOptionsJavaGenerateEqualsAndHash = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage
          0x1d8
          0xffff
          2
          decodeFieldBool
          (\v -> stage_5 (msg { fileOptionsJavaStringCheckUtf8 = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_5 msg gl_0 =
        inOrderStage1
          (0x48 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_6 (msg { fileOptionsOptimizeFor = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_6 msg gl_0 =
        inOrderStage1
          (0x5a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_7 (msg { fileOptionsGoPackage = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_7 msg gl_0 =
        inOrderStage
          0x180
          0xffff
          2
          decodeFieldBool
          (\v -> loop (msg { fileOptionsCcGenericServices = (Just v)}) gl_0)
          (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.fileOptionsUnknownFields of { [] -> msg { fileOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { fileOptionsUninterpretedOption = growListToVector gl_0, fileOptionsUnknownFields = reverse (msg.fileOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsJavaPackage = (Just v)}) gl_0
          8 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsJavaOuterClassname = (Just v)}) gl_0
          10 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsJavaMultipleFiles = (Just v)}) gl_0
          20 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsJavaGenerateEqualsAndHash = (Just v)}) gl_0
          27 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsJavaStringCheckUtf8 = (Just v)}) gl_0
          9 -> do
            v <- decodeFieldEnum
            loop (msg { fileOptionsOptimizeFor = (Just v)}) gl_0
          11 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsGoPackage = (Just v)}) gl_0
          16 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsCcGenericServices = (Just v)}) gl_0
          17 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsJavaGenericServices = (Just v)}) gl_0
          18 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsPyGenericServices = (Just v)}) gl_0
          23 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsDeprecated = (Just v)}) gl_0
          31 -> do
            v <- decodeFieldBool
            loop (msg { fileOptionsCcEnableArenas = (Just v)}) gl_0
          36 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsObjcClassPrefix = (Just v)}) gl_0
          37 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsCsharpNamespace = (Just v)}) gl_0
          39 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsSwiftPrefix = (Just v)}) gl_0
          40 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsPhpClassPrefix = (Just v)}) gl_0
          41 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsPhpNamespace = (Just v)}) gl_0
          44 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsPhpMetadataNamespace = (Just v)}) gl_0
          45 -> do
            v <- decodeFieldString
            loop (msg { fileOptionsRubyPackage = (Just v)}) gl_0
          50 -> do
            v <- decodeFieldMessage
            loop (msg { fileOptionsFeatures = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fileOptionsUnknownFields = (uf : msg.fileOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'FileOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fileOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FileOptions)
fileOptionsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "java_package"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaPackage
        , fdSet = \v m -> m { fileOptionsJavaPackage = v }
        }), (8, SomeField FieldDescriptor
        { fdName = "java_outer_classname"
        , fdNumber = 8
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaOuterClassname
        , fdSet = \v m -> m { fileOptionsJavaOuterClassname = v }
        })
    , (10, SomeField FieldDescriptor
        { fdName = "java_multiple_files"
        , fdNumber = 10
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaMultipleFiles
        , fdSet = \v m -> m { fileOptionsJavaMultipleFiles = v }
        })
    , (20, SomeField FieldDescriptor
        { fdName = "java_generate_equals_and_hash"
        , fdNumber = 20
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaGenerateEqualsAndHash
        , fdSet = \v m -> m { fileOptionsJavaGenerateEqualsAndHash = v }
        })
    , (27, SomeField FieldDescriptor
        { fdName = "java_string_check_utf8"
        , fdNumber = 27
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaStringCheckUtf8
        , fdSet = \v m -> m { fileOptionsJavaStringCheckUtf8 = v }
        })
    , (9, SomeField FieldDescriptor
        { fdName = "optimize_for"
        , fdNumber = 9
        , fdTypeDesc = MessageType "OptimizeMode"
        , fdLabel = LabelOptional
        , fdGet = fileOptionsOptimizeFor
        , fdSet = \v m -> m { fileOptionsOptimizeFor = v }
        })
    , (11, SomeField FieldDescriptor
        { fdName = "go_package"
        , fdNumber = 11
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsGoPackage
        , fdSet = \v m -> m { fileOptionsGoPackage = v }
        })
    , (16, SomeField FieldDescriptor
        { fdName = "cc_generic_services"
        , fdNumber = 16
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsCcGenericServices
        , fdSet = \v m -> m { fileOptionsCcGenericServices = v }
        })
    , (17, SomeField FieldDescriptor
        { fdName = "java_generic_services"
        , fdNumber = 17
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsJavaGenericServices
        , fdSet = \v m -> m { fileOptionsJavaGenericServices = v }
        })
    , (18, SomeField FieldDescriptor
        { fdName = "py_generic_services"
        , fdNumber = 18
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsPyGenericServices
        , fdSet = \v m -> m { fileOptionsPyGenericServices = v }
        })
    , (23, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 23
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsDeprecated
        , fdSet = \v m -> m { fileOptionsDeprecated = v }
        })
    , (31, SomeField FieldDescriptor
        { fdName = "cc_enable_arenas"
        , fdNumber = 31
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsCcEnableArenas
        , fdSet = \v m -> m { fileOptionsCcEnableArenas = v }
        })
    , (36, SomeField FieldDescriptor
        { fdName = "objc_class_prefix"
        , fdNumber = 36
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsObjcClassPrefix
        , fdSet = \v m -> m { fileOptionsObjcClassPrefix = v }
        })
    , (37, SomeField FieldDescriptor
        { fdName = "csharp_namespace"
        , fdNumber = 37
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsCsharpNamespace
        , fdSet = \v m -> m { fileOptionsCsharpNamespace = v }
        })
    , (39, SomeField FieldDescriptor
        { fdName = "swift_prefix"
        , fdNumber = 39
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsSwiftPrefix
        , fdSet = \v m -> m { fileOptionsSwiftPrefix = v }
        })
    , (40, SomeField FieldDescriptor
        { fdName = "php_class_prefix"
        , fdNumber = 40
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsPhpClassPrefix
        , fdSet = \v m -> m { fileOptionsPhpClassPrefix = v }
        })
    , (41, SomeField FieldDescriptor
        { fdName = "php_namespace"
        , fdNumber = 41
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsPhpNamespace
        , fdSet = \v m -> m { fileOptionsPhpNamespace = v }
        })
    , (44, SomeField FieldDescriptor
        { fdName = "php_metadata_namespace"
        , fdNumber = 44
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsPhpMetadataNamespace
        , fdSet = \v m -> m { fileOptionsPhpMetadataNamespace = v }
        })
    , (45, SomeField FieldDescriptor
        { fdName = "ruby_package"
        , fdNumber = 45
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fileOptionsRubyPackage
        , fdSet = \v m -> m { fileOptionsRubyPackage = v }
        })
    , (50, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 50
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = fileOptionsFeatures
        , fdSet = \v m -> m { fileOptionsFeatures = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = fileOptionsUninterpretedOption
        , fdSet = \v m -> m { fileOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage FileOptions where
  protoMessageName _ = "google.protobuf.FileOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFileOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fileOptionsFieldDescriptors

instance IsMessage FileOptions

instance Aeson.ToJSON FileOptions where
  toJSON msg = jsonObject
      [ "javaPackage" .=: msg.fileOptionsJavaPackage
      , "javaOuterClassname" .=: msg.fileOptionsJavaOuterClassname
      , "javaMultipleFiles" .=: msg.fileOptionsJavaMultipleFiles
      , "javaGenerateEqualsAndHash" .=: msg.fileOptionsJavaGenerateEqualsAndHash
      , "javaStringCheckUtf8" .=: msg.fileOptionsJavaStringCheckUtf8
      , "optimizeFor" .=: msg.fileOptionsOptimizeFor
      , "goPackage" .=: msg.fileOptionsGoPackage
      , "ccGenericServices" .=: msg.fileOptionsCcGenericServices
      , "javaGenericServices" .=: msg.fileOptionsJavaGenericServices
      , "pyGenericServices" .=: msg.fileOptionsPyGenericServices
      , "deprecated" .=: msg.fileOptionsDeprecated
      , "ccEnableArenas" .=: msg.fileOptionsCcEnableArenas
      , "objcClassPrefix" .=: msg.fileOptionsObjcClassPrefix
      , "csharpNamespace" .=: msg.fileOptionsCsharpNamespace
      , "swiftPrefix" .=: msg.fileOptionsSwiftPrefix
      , "phpClassPrefix" .=: msg.fileOptionsPhpClassPrefix
      , "phpNamespace" .=: msg.fileOptionsPhpNamespace
      , "phpMetadataNamespace" .=: msg.fileOptionsPhpMetadataNamespace
      , "rubyPackage" .=: msg.fileOptionsRubyPackage
      , "features" .=: msg.fileOptionsFeatures
      , "uninterpretedOption" .=: msg.fileOptionsUninterpretedOption
      ]

instance Aeson.FromJSON FileOptions where
  parseJSON = Aeson.withObject "FileOptions" $ \obj -> do
    fld_fileOptionsJavaPackage <- parseFieldMaybe obj "javaPackage"
    fld_fileOptionsJavaOuterClassname <- parseFieldMaybe obj "javaOuterClassname"
    fld_fileOptionsJavaMultipleFiles <- parseFieldMaybe obj "javaMultipleFiles"
    fld_fileOptionsJavaGenerateEqualsAndHash <- parseFieldMaybe obj "javaGenerateEqualsAndHash"
    fld_fileOptionsJavaStringCheckUtf8 <- parseFieldMaybe obj "javaStringCheckUtf8"
    fld_fileOptionsOptimizeFor <- parseFieldMaybe obj "optimizeFor"
    fld_fileOptionsGoPackage <- parseFieldMaybe obj "goPackage"
    fld_fileOptionsCcGenericServices <- parseFieldMaybe obj "ccGenericServices"
    fld_fileOptionsJavaGenericServices <- parseFieldMaybe obj "javaGenericServices"
    fld_fileOptionsPyGenericServices <- parseFieldMaybe obj "pyGenericServices"
    fld_fileOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_fileOptionsCcEnableArenas <- parseFieldMaybe obj "ccEnableArenas"
    fld_fileOptionsObjcClassPrefix <- parseFieldMaybe obj "objcClassPrefix"
    fld_fileOptionsCsharpNamespace <- parseFieldMaybe obj "csharpNamespace"
    fld_fileOptionsSwiftPrefix <- parseFieldMaybe obj "swiftPrefix"
    fld_fileOptionsPhpClassPrefix <- parseFieldMaybe obj "phpClassPrefix"
    fld_fileOptionsPhpNamespace <- parseFieldMaybe obj "phpNamespace"
    fld_fileOptionsPhpMetadataNamespace <- parseFieldMaybe obj "phpMetadataNamespace"
    fld_fileOptionsRubyPackage <- parseFieldMaybe obj "rubyPackage"
    fld_fileOptionsFeatures <- parseFieldMaybe obj "features"
    fld_fileOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultFileOptions
      { fileOptionsJavaPackage = maybe (fileOptionsJavaPackage defaultFileOptions) id fld_fileOptionsJavaPackage
      , fileOptionsJavaOuterClassname = maybe (fileOptionsJavaOuterClassname defaultFileOptions) id fld_fileOptionsJavaOuterClassname
      , fileOptionsJavaMultipleFiles = maybe (fileOptionsJavaMultipleFiles defaultFileOptions) id fld_fileOptionsJavaMultipleFiles
      , fileOptionsJavaGenerateEqualsAndHash = maybe (fileOptionsJavaGenerateEqualsAndHash defaultFileOptions) id fld_fileOptionsJavaGenerateEqualsAndHash
      , fileOptionsJavaStringCheckUtf8 = maybe (fileOptionsJavaStringCheckUtf8 defaultFileOptions) id fld_fileOptionsJavaStringCheckUtf8
      , fileOptionsOptimizeFor = maybe (fileOptionsOptimizeFor defaultFileOptions) id fld_fileOptionsOptimizeFor
      , fileOptionsGoPackage = maybe (fileOptionsGoPackage defaultFileOptions) id fld_fileOptionsGoPackage
      , fileOptionsCcGenericServices = maybe (fileOptionsCcGenericServices defaultFileOptions) id fld_fileOptionsCcGenericServices
      , fileOptionsJavaGenericServices = maybe (fileOptionsJavaGenericServices defaultFileOptions) id fld_fileOptionsJavaGenericServices
      , fileOptionsPyGenericServices = maybe (fileOptionsPyGenericServices defaultFileOptions) id fld_fileOptionsPyGenericServices
      , fileOptionsDeprecated = maybe (fileOptionsDeprecated defaultFileOptions) id fld_fileOptionsDeprecated
      , fileOptionsCcEnableArenas = maybe (fileOptionsCcEnableArenas defaultFileOptions) id fld_fileOptionsCcEnableArenas
      , fileOptionsObjcClassPrefix = maybe (fileOptionsObjcClassPrefix defaultFileOptions) id fld_fileOptionsObjcClassPrefix
      , fileOptionsCsharpNamespace = maybe (fileOptionsCsharpNamespace defaultFileOptions) id fld_fileOptionsCsharpNamespace
      , fileOptionsSwiftPrefix = maybe (fileOptionsSwiftPrefix defaultFileOptions) id fld_fileOptionsSwiftPrefix
      , fileOptionsPhpClassPrefix = maybe (fileOptionsPhpClassPrefix defaultFileOptions) id fld_fileOptionsPhpClassPrefix
      , fileOptionsPhpNamespace = maybe (fileOptionsPhpNamespace defaultFileOptions) id fld_fileOptionsPhpNamespace
      , fileOptionsPhpMetadataNamespace = maybe (fileOptionsPhpMetadataNamespace defaultFileOptions) id fld_fileOptionsPhpMetadataNamespace
      , fileOptionsRubyPackage = maybe (fileOptionsRubyPackage defaultFileOptions) id fld_fileOptionsRubyPackage
      , fileOptionsFeatures = maybe (fileOptionsFeatures defaultFileOptions) id fld_fileOptionsFeatures
      , fileOptionsUninterpretedOption = maybe (fileOptionsUninterpretedOption defaultFileOptions) id fld_fileOptionsUninterpretedOption
      }

instance Hashable FileOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.fileOptionsJavaPackage) msg.fileOptionsJavaOuterClassname) msg.fileOptionsJavaMultipleFiles) msg.fileOptionsJavaGenerateEqualsAndHash) msg.fileOptionsJavaStringCheckUtf8) msg.fileOptionsOptimizeFor) msg.fileOptionsGoPackage) msg.fileOptionsCcGenericServices) msg.fileOptionsJavaGenericServices) msg.fileOptionsPyGenericServices) msg.fileOptionsDeprecated) msg.fileOptionsCcEnableArenas) msg.fileOptionsObjcClassPrefix) msg.fileOptionsCsharpNamespace) msg.fileOptionsSwiftPrefix) msg.fileOptionsPhpClassPrefix) msg.fileOptionsPhpNamespace) msg.fileOptionsPhpMetadataNamespace) msg.fileOptionsRubyPackage) msg.fileOptionsFeatures) msg.fileOptionsUninterpretedOption

instance Proto.Extension.HasExtensions FileOptions where
  messageUnknownFields = fileOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { fileOptionsUnknownFields = ufs }

instance Semigroup FileOptions where
  a <> b = FileOptions
    { fileOptionsJavaPackage = case b.fileOptionsJavaPackage of { Nothing -> a.fileOptionsJavaPackage; x -> x }
    , fileOptionsJavaOuterClassname = case b.fileOptionsJavaOuterClassname of { Nothing -> a.fileOptionsJavaOuterClassname; x -> x }
    , fileOptionsJavaMultipleFiles = case b.fileOptionsJavaMultipleFiles of { Nothing -> a.fileOptionsJavaMultipleFiles; x -> x }
    , fileOptionsJavaGenerateEqualsAndHash = case b.fileOptionsJavaGenerateEqualsAndHash of { Nothing -> a.fileOptionsJavaGenerateEqualsAndHash; x -> x }
    , fileOptionsJavaStringCheckUtf8 = case b.fileOptionsJavaStringCheckUtf8 of { Nothing -> a.fileOptionsJavaStringCheckUtf8; x -> x }
    , fileOptionsOptimizeFor = case b.fileOptionsOptimizeFor of { Nothing -> a.fileOptionsOptimizeFor; x -> x }
    , fileOptionsGoPackage = case b.fileOptionsGoPackage of { Nothing -> a.fileOptionsGoPackage; x -> x }
    , fileOptionsCcGenericServices = case b.fileOptionsCcGenericServices of { Nothing -> a.fileOptionsCcGenericServices; x -> x }
    , fileOptionsJavaGenericServices = case b.fileOptionsJavaGenericServices of { Nothing -> a.fileOptionsJavaGenericServices; x -> x }
    , fileOptionsPyGenericServices = case b.fileOptionsPyGenericServices of { Nothing -> a.fileOptionsPyGenericServices; x -> x }
    , fileOptionsDeprecated = case b.fileOptionsDeprecated of { Nothing -> a.fileOptionsDeprecated; x -> x }
    , fileOptionsCcEnableArenas = case b.fileOptionsCcEnableArenas of { Nothing -> a.fileOptionsCcEnableArenas; x -> x }
    , fileOptionsObjcClassPrefix = case b.fileOptionsObjcClassPrefix of { Nothing -> a.fileOptionsObjcClassPrefix; x -> x }
    , fileOptionsCsharpNamespace = case b.fileOptionsCsharpNamespace of { Nothing -> a.fileOptionsCsharpNamespace; x -> x }
    , fileOptionsSwiftPrefix = case b.fileOptionsSwiftPrefix of { Nothing -> a.fileOptionsSwiftPrefix; x -> x }
    , fileOptionsPhpClassPrefix = case b.fileOptionsPhpClassPrefix of { Nothing -> a.fileOptionsPhpClassPrefix; x -> x }
    , fileOptionsPhpNamespace = case b.fileOptionsPhpNamespace of { Nothing -> a.fileOptionsPhpNamespace; x -> x }
    , fileOptionsPhpMetadataNamespace = case b.fileOptionsPhpMetadataNamespace of { Nothing -> a.fileOptionsPhpMetadataNamespace; x -> x }
    , fileOptionsRubyPackage = case b.fileOptionsRubyPackage of { Nothing -> a.fileOptionsRubyPackage; x -> x }
    , fileOptionsFeatures = case b.fileOptionsFeatures of { Nothing -> a.fileOptionsFeatures; x -> x }
    , fileOptionsUninterpretedOption = a.fileOptionsUninterpretedOption <> b.fileOptionsUninterpretedOption
    , fileOptionsUnknownFields = a.fileOptionsUnknownFields <> b.fileOptionsUnknownFields
    }

instance Monoid FileOptions where
  mempty = defaultFileOptions

data MessageOptions = MessageOptions
  { messageOptionsMessageSetWireFormat :: !(Maybe Bool)
    -- ^ Set true to use the old proto1 MessageSet wire format for extensions.
    -- This is provided for backwards-compatibility with the MessageSet wire
    -- format.  You should not use this for any other reason:  It's less
    -- efficient, has fewer features, and is more complicated.
    -- 
    -- The message must be defined exactly as follows:
    --   message Foo {
    --     option message_set_wire_format = true;
    --     extensions 4 to max;
    --   }
    -- Note that the message cannot have any defined fields; MessageSets only
    -- have extensions.
    -- 
    -- All extensions of your type must be singular messages; e.g. they cannot
    -- be int32s, enums, or repeated messages.
    -- 
    -- Because this is an option, the above two restrictions are not enforced by
    -- the protocol compiler.
  , messageOptionsNoStandardDescriptorAccessor :: !(Maybe Bool)
    -- ^ Disables the generation of the standard "descriptor()" accessor, which can
    -- conflict with a field of the same name.  This is meant to make migration
    -- from proto1 easier; new code should avoid fields named "descriptor".
  , messageOptionsDeprecated :: !(Maybe Bool)
    -- ^ Is this message deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for the message, or it will be completely ignored; in the very least,
    -- this is a formalization for deprecating messages.
  , messageOptionsMapEntry :: !(Maybe Bool)
    -- ^ Whether the message is an automatically generated map entry type for the
    -- maps field.
    -- 
    -- For maps fields:
    --     map<KeyType, ValueType> map_field = 1;
    -- The parsed descriptor looks like:
    --     message MapFieldEntry {
    --         option map_entry = true;
    --         optional KeyType key = 1;
    --         optional ValueType value = 2;
    --     }
    --     repeated MapFieldEntry map_field = 1;
    -- 
    -- Implementations may choose not to generate the map_entry=true message, but
    -- use a native map in the target language to hold the keys and values.
    -- The reflection APIs in such implementations still need to work as
    -- if the field is a repeated message field.
    -- 
    -- NOTE: Do not set the option in .proto files. Always use the maps syntax
    -- instead. The option should only be implicitly set by the proto compiler
    -- parser.
  , messageOptionsDeprecatedLegacyJsonFieldConflicts :: !(Maybe Bool)
    -- ^ Enable the legacy handling of JSON field name conflicts.  This lowercases
    -- and strips underscored from the fields before comparison in proto3 only.
    -- The new behavior takes `json_name` into account and applies to proto2 as
    -- well.
    -- 
    -- This should only be used as a temporary measure against broken builds due
    -- to the change in behavior for JSON field name conflicts.
    -- 
    -- TODO This is legacy behavior we plan to remove once downstream
    -- teams have had time to migrate.
  , messageOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , messageOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , messageOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultMessageOptions :: MessageOptions
defaultMessageOptions = MessageOptions
  { messageOptionsMessageSetWireFormat = Nothing
  , messageOptionsNoStandardDescriptorAccessor = Nothing
  , messageOptionsDeprecated = Nothing
  , messageOptionsMapEntry = Nothing
  , messageOptionsDeprecatedLegacyJsonFieldConflicts = Nothing
  , messageOptionsFeatures = Nothing
  , messageOptionsUninterpretedOption = V.empty
  , messageOptionsUnknownFields = []
  }

instance MessageEncode MessageOptions where
  buildSized msg =
    (maybe mempty (\v -> archBool 8 v) msg.messageOptionsMessageSetWireFormat)
    <> (maybe mempty (\v -> archBool 16 v) msg.messageOptionsNoStandardDescriptorAccessor)
    <> (maybe mempty (\v -> archBool 24 v) msg.messageOptionsDeprecated)
    <> (maybe mempty (\v -> archBool 56 v) msg.messageOptionsMapEntry)
    <> (maybe mempty (\v -> archBool 88 v) msg.messageOptionsDeprecatedLegacyJsonFieldConflicts)
    <> (maybe mempty (\v -> archSubmessage 98 (buildSized v)) msg.messageOptionsFeatures)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.messageOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.messageOptionsUnknownFields

instance MessageDecode MessageOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultMessageOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_1 (msg { messageOptionsMessageSetWireFormat = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_2 (msg { messageOptionsNoStandardDescriptorAccessor = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_3 (msg { messageOptionsDeprecated = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage1
          (0x38 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_4 (msg { messageOptionsMapEntry = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage1
          (0x58 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_5 (msg { messageOptionsDeprecatedLegacyJsonFieldConflicts = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_5 msg gl_0 =
        inOrderStage1
          (0x62 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_6 (msg { messageOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_6 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_6 msg (snocGrowList gl_0 v))
          (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.messageOptionsUnknownFields of { [] -> msg { messageOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { messageOptionsUninterpretedOption = growListToVector gl_0, messageOptionsUnknownFields = reverse (msg.messageOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldBool
            loop (msg { messageOptionsMessageSetWireFormat = (Just v)}) gl_0
          2 -> do
            v <- decodeFieldBool
            loop (msg { messageOptionsNoStandardDescriptorAccessor = (Just v)}) gl_0
          3 -> do
            v <- decodeFieldBool
            loop (msg { messageOptionsDeprecated = (Just v)}) gl_0
          7 -> do
            v <- decodeFieldBool
            loop (msg { messageOptionsMapEntry = (Just v)}) gl_0
          11 -> do
            v <- decodeFieldBool
            loop (msg { messageOptionsDeprecatedLegacyJsonFieldConflicts = (Just v)}) gl_0
          12 -> do
            v <- decodeFieldMessage
            loop (msg { messageOptionsFeatures = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { messageOptionsUnknownFields = (uf : msg.messageOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'MessageOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
messageOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor MessageOptions)
messageOptionsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "message_set_wire_format"
        , fdNumber = 1
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = messageOptionsMessageSetWireFormat
        , fdSet = \v m -> m { messageOptionsMessageSetWireFormat = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "no_standard_descriptor_accessor"
        , fdNumber = 2
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = messageOptionsNoStandardDescriptorAccessor
        , fdSet = \v m -> m { messageOptionsNoStandardDescriptorAccessor = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 3
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = messageOptionsDeprecated
        , fdSet = \v m -> m { messageOptionsDeprecated = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "map_entry"
        , fdNumber = 7
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = messageOptionsMapEntry
        , fdSet = \v m -> m { messageOptionsMapEntry = v }
        })
    , (11, SomeField FieldDescriptor
        { fdName = "deprecated_legacy_json_field_conflicts"
        , fdNumber = 11
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = messageOptionsDeprecatedLegacyJsonFieldConflicts
        , fdSet = \v m -> m { messageOptionsDeprecatedLegacyJsonFieldConflicts = v }
        })
    , (12, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 12
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = messageOptionsFeatures
        , fdSet = \v m -> m { messageOptionsFeatures = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = messageOptionsUninterpretedOption
        , fdSet = \v m -> m { messageOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage MessageOptions where
  protoMessageName _ = "google.protobuf.MessageOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultMessageOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = messageOptionsFieldDescriptors

instance IsMessage MessageOptions

instance Aeson.ToJSON MessageOptions where
  toJSON msg = jsonObject
      [ "messageSetWireFormat" .=: msg.messageOptionsMessageSetWireFormat
      , "noStandardDescriptorAccessor" .=: msg.messageOptionsNoStandardDescriptorAccessor
      , "deprecated" .=: msg.messageOptionsDeprecated
      , "mapEntry" .=: msg.messageOptionsMapEntry
      , "deprecatedLegacyJsonFieldConflicts" .=: msg.messageOptionsDeprecatedLegacyJsonFieldConflicts
      , "features" .=: msg.messageOptionsFeatures
      , "uninterpretedOption" .=: msg.messageOptionsUninterpretedOption
      ]

instance Aeson.FromJSON MessageOptions where
  parseJSON = Aeson.withObject "MessageOptions" $ \obj -> do
    fld_messageOptionsMessageSetWireFormat <- parseFieldMaybe obj "messageSetWireFormat"
    fld_messageOptionsNoStandardDescriptorAccessor <- parseFieldMaybe obj "noStandardDescriptorAccessor"
    fld_messageOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_messageOptionsMapEntry <- parseFieldMaybe obj "mapEntry"
    fld_messageOptionsDeprecatedLegacyJsonFieldConflicts <- parseFieldMaybe obj "deprecatedLegacyJsonFieldConflicts"
    fld_messageOptionsFeatures <- parseFieldMaybe obj "features"
    fld_messageOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultMessageOptions
      { messageOptionsMessageSetWireFormat = maybe (messageOptionsMessageSetWireFormat defaultMessageOptions) id fld_messageOptionsMessageSetWireFormat
      , messageOptionsNoStandardDescriptorAccessor = maybe (messageOptionsNoStandardDescriptorAccessor defaultMessageOptions) id fld_messageOptionsNoStandardDescriptorAccessor
      , messageOptionsDeprecated = maybe (messageOptionsDeprecated defaultMessageOptions) id fld_messageOptionsDeprecated
      , messageOptionsMapEntry = maybe (messageOptionsMapEntry defaultMessageOptions) id fld_messageOptionsMapEntry
      , messageOptionsDeprecatedLegacyJsonFieldConflicts = maybe (messageOptionsDeprecatedLegacyJsonFieldConflicts defaultMessageOptions) id fld_messageOptionsDeprecatedLegacyJsonFieldConflicts
      , messageOptionsFeatures = maybe (messageOptionsFeatures defaultMessageOptions) id fld_messageOptionsFeatures
      , messageOptionsUninterpretedOption = maybe (messageOptionsUninterpretedOption defaultMessageOptions) id fld_messageOptionsUninterpretedOption
      }

instance Hashable MessageOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.messageOptionsMessageSetWireFormat) msg.messageOptionsNoStandardDescriptorAccessor) msg.messageOptionsDeprecated) msg.messageOptionsMapEntry) msg.messageOptionsDeprecatedLegacyJsonFieldConflicts) msg.messageOptionsFeatures) msg.messageOptionsUninterpretedOption

instance Proto.Extension.HasExtensions MessageOptions where
  messageUnknownFields = messageOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { messageOptionsUnknownFields = ufs }

instance Semigroup MessageOptions where
  a <> b = MessageOptions
    { messageOptionsMessageSetWireFormat = case b.messageOptionsMessageSetWireFormat of { Nothing -> a.messageOptionsMessageSetWireFormat; x -> x }
    , messageOptionsNoStandardDescriptorAccessor = case b.messageOptionsNoStandardDescriptorAccessor of { Nothing -> a.messageOptionsNoStandardDescriptorAccessor; x -> x }
    , messageOptionsDeprecated = case b.messageOptionsDeprecated of { Nothing -> a.messageOptionsDeprecated; x -> x }
    , messageOptionsMapEntry = case b.messageOptionsMapEntry of { Nothing -> a.messageOptionsMapEntry; x -> x }
    , messageOptionsDeprecatedLegacyJsonFieldConflicts = case b.messageOptionsDeprecatedLegacyJsonFieldConflicts of { Nothing -> a.messageOptionsDeprecatedLegacyJsonFieldConflicts; x -> x }
    , messageOptionsFeatures = case b.messageOptionsFeatures of { Nothing -> a.messageOptionsFeatures; x -> x }
    , messageOptionsUninterpretedOption = a.messageOptionsUninterpretedOption <> b.messageOptionsUninterpretedOption
    , messageOptionsUnknownFields = a.messageOptionsUnknownFields <> b.messageOptionsUnknownFields
    }

instance Monoid MessageOptions where
  mempty = defaultMessageOptions

data FieldOptions = FieldOptions
  { fieldOptionsCtype :: !(Maybe FieldOptions'CType)
    -- ^ NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
    -- The ctype option instructs the C++ code generator to use a different
    -- representation of the field than it normally would.  See the specific
    -- options below.  This option is only implemented to support use of
    -- [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
    -- type "bytes" in the open source release.
    -- TODO: make ctype actually deprecated.
  , fieldOptionsPacked :: !(Maybe Bool)
    -- ^ The packed option can be enabled for repeated primitive fields to enable
    -- a more efficient representation on the wire. Rather than repeatedly
    -- writing the tag and type for each element, the entire array is encoded as
    -- a single length-delimited blob. In proto3, only explicit setting it to
    -- false will avoid using packed encoding.  This option is prohibited in
    -- Editions, but the `repeated_field_encoding` feature can be used to control
    -- the behavior.
  , fieldOptionsJstype :: !(Maybe FieldOptions'JSType)
    -- ^ The jstype option determines the JavaScript type used for values of the
    -- field.  The option is permitted only for 64 bit integral and fixed types
    -- (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
    -- is represented as JavaScript string, which avoids loss of precision that
    -- can happen when a large value is converted to a floating point JavaScript.
    -- Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
    -- use the JavaScript "number" type.  The behavior of the default option
    -- JS_NORMAL is implementation dependent.
    -- 
    -- This option is an enum to permit additional types to be added, e.g.
    -- goog.math.Integer.
  , fieldOptionsLazy :: !(Maybe Bool)
    -- ^ Should this field be parsed lazily?  Lazy applies only to message-type
    -- fields.  It means that when the outer message is initially parsed, the
    -- inner message's contents will not be parsed but instead stored in encoded
    -- form.  The inner message will actually be parsed when it is first accessed.
    -- 
    -- This is only a hint.  Implementations are free to choose whether to use
    -- eager or lazy parsing regardless of the value of this option.  However,
    -- setting this option true suggests that the protocol author believes that
    -- using lazy parsing on this field is worth the additional bookkeeping
    -- overhead typically needed to implement it.
    -- 
    -- This option does not affect the public interface of any generated code;
    -- all method signatures remain the same.  Furthermore, thread-safety of the
    -- interface is not affected by this option; const methods remain safe to
    -- call from multiple threads concurrently, while non-const methods continue
    -- to require exclusive access.
    -- 
    -- Note that lazy message fields are still eagerly verified to check
    -- ill-formed wireformat or missing required fields. Calling IsInitialized()
    -- on the outer message would fail if the inner message has missing required
    -- fields. Failed verification would result in parsing failure (except when
    -- uninitialized messages are acceptable).
  , fieldOptionsUnverifiedLazy :: !(Maybe Bool)
    -- ^ unverified_lazy does no correctness checks on the byte stream. This should
    -- only be used where lazy with verification is prohibitive for performance
    -- reasons.
  , fieldOptionsDeprecated :: !(Maybe Bool)
    -- ^ Is this field deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for accessors, or it will be completely ignored; in the very least, this
    -- is a formalization for deprecating fields.
  , fieldOptionsWeak :: !(Maybe Bool)
    -- ^ For Google-internal migration only. Do not use.
  , fieldOptionsDebugRedact :: !(Maybe Bool)
    -- ^ Indicate that the field value should not be printed out when using debug
    -- formats, e.g. when the field contains sensitive credentials.
  , fieldOptionsRetention :: !(Maybe FieldOptions'OptionRetention)
  , fieldOptionsTargets :: !(V.Vector FieldOptions'OptionTargetType)
  , fieldOptionsEditionDefaults :: !(V.Vector FieldOptions'EditionDefault)
  , fieldOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , fieldOptionsFeatureSupport :: !(Maybe FieldOptions'FeatureSupport)
  , fieldOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , fieldOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data FieldOptions'CType
  = FieldOptions'CType'String
    -- ^ Default mode.
  | FieldOptions'CType'Cord
    -- ^ The option [ctype=CORD] may be applied to a non-repeated field of type
    -- "bytes". It indicates that in C++, the data should be stored in a Cord
    -- instead of a string.  For very large strings, this may reduce memory
    -- fragmentation. It may also allow better performance when parsing from a
    -- Cord, or when parsing with aliasing enabled, as the parsed Cord may then
    -- alias the original buffer.
  | FieldOptions'CType'StringPiece
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldOptions'CType :: FieldOptions'CType -> Int
toProtoEnumFieldOptions'CType FieldOptions'CType'String = 0
toProtoEnumFieldOptions'CType FieldOptions'CType'Cord = 1
toProtoEnumFieldOptions'CType FieldOptions'CType'StringPiece = 2

fromProtoEnumFieldOptions'CType :: Int -> Maybe FieldOptions'CType
fromProtoEnumFieldOptions'CType 0 = Just FieldOptions'CType'String
fromProtoEnumFieldOptions'CType 1 = Just FieldOptions'CType'Cord
fromProtoEnumFieldOptions'CType 2 = Just FieldOptions'CType'StringPiece
fromProtoEnumFieldOptions'CType _ = Nothing

instance MessageEncode FieldOptions'CType where
  buildSized _ = mempty
instance MessageDecode FieldOptions'CType where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldOptions'CType where
  toJSON FieldOptions'CType'String = Aeson.String "STRING"
  toJSON FieldOptions'CType'Cord = Aeson.String "CORD"
  toJSON FieldOptions'CType'StringPiece = Aeson.String "STRING_PIECE"

instance Aeson.FromJSON FieldOptions'CType where
  parseJSON = \case
    Aeson.String "STRING" -> pure FieldOptions'CType'String
    Aeson.String "CORD" -> pure FieldOptions'CType'Cord
    Aeson.String "STRING_PIECE" -> pure FieldOptions'CType'StringPiece
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldOptions'CType"

instance Hashable FieldOptions'CType where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldOptions'CType x)

data FieldOptions'JSType
  = FieldOptions'JSType'JsNormal
    -- ^ Use the default type.
  | FieldOptions'JSType'JsString
    -- ^ Use JavaScript strings.
  | FieldOptions'JSType'JsNumber
    -- ^ Use JavaScript numbers.
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldOptions'JSType :: FieldOptions'JSType -> Int
toProtoEnumFieldOptions'JSType FieldOptions'JSType'JsNormal = 0
toProtoEnumFieldOptions'JSType FieldOptions'JSType'JsString = 1
toProtoEnumFieldOptions'JSType FieldOptions'JSType'JsNumber = 2

fromProtoEnumFieldOptions'JSType :: Int -> Maybe FieldOptions'JSType
fromProtoEnumFieldOptions'JSType 0 = Just FieldOptions'JSType'JsNormal
fromProtoEnumFieldOptions'JSType 1 = Just FieldOptions'JSType'JsString
fromProtoEnumFieldOptions'JSType 2 = Just FieldOptions'JSType'JsNumber
fromProtoEnumFieldOptions'JSType _ = Nothing

instance MessageEncode FieldOptions'JSType where
  buildSized _ = mempty
instance MessageDecode FieldOptions'JSType where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldOptions'JSType where
  toJSON FieldOptions'JSType'JsNormal = Aeson.String "JS_NORMAL"
  toJSON FieldOptions'JSType'JsString = Aeson.String "JS_STRING"
  toJSON FieldOptions'JSType'JsNumber = Aeson.String "JS_NUMBER"

instance Aeson.FromJSON FieldOptions'JSType where
  parseJSON = \case
    Aeson.String "JS_NORMAL" -> pure FieldOptions'JSType'JsNormal
    Aeson.String "JS_STRING" -> pure FieldOptions'JSType'JsString
    Aeson.String "JS_NUMBER" -> pure FieldOptions'JSType'JsNumber
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldOptions'JSType"

instance Hashable FieldOptions'JSType where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldOptions'JSType x)

-- | If set to RETENTION_SOURCE, the option will be omitted from the binary.
-- Note: as of January 2023, support for this is in progress and does not yet
-- have an effect (b/264593489).
data FieldOptions'OptionRetention
  = FieldOptions'OptionRetention'RetentionUnknown
  | FieldOptions'OptionRetention'RetentionRuntime
  | FieldOptions'OptionRetention'RetentionSource
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldOptions'OptionRetention :: FieldOptions'OptionRetention -> Int
toProtoEnumFieldOptions'OptionRetention FieldOptions'OptionRetention'RetentionUnknown = 0
toProtoEnumFieldOptions'OptionRetention FieldOptions'OptionRetention'RetentionRuntime = 1
toProtoEnumFieldOptions'OptionRetention FieldOptions'OptionRetention'RetentionSource = 2

fromProtoEnumFieldOptions'OptionRetention :: Int -> Maybe FieldOptions'OptionRetention
fromProtoEnumFieldOptions'OptionRetention 0 = Just FieldOptions'OptionRetention'RetentionUnknown
fromProtoEnumFieldOptions'OptionRetention 1 = Just FieldOptions'OptionRetention'RetentionRuntime
fromProtoEnumFieldOptions'OptionRetention 2 = Just FieldOptions'OptionRetention'RetentionSource
fromProtoEnumFieldOptions'OptionRetention _ = Nothing

instance MessageEncode FieldOptions'OptionRetention where
  buildSized _ = mempty
instance MessageDecode FieldOptions'OptionRetention where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldOptions'OptionRetention where
  toJSON FieldOptions'OptionRetention'RetentionUnknown = Aeson.String "RETENTION_UNKNOWN"
  toJSON FieldOptions'OptionRetention'RetentionRuntime = Aeson.String "RETENTION_RUNTIME"
  toJSON FieldOptions'OptionRetention'RetentionSource = Aeson.String "RETENTION_SOURCE"

instance Aeson.FromJSON FieldOptions'OptionRetention where
  parseJSON = \case
    Aeson.String "RETENTION_UNKNOWN" -> pure FieldOptions'OptionRetention'RetentionUnknown
    Aeson.String "RETENTION_RUNTIME" -> pure FieldOptions'OptionRetention'RetentionRuntime
    Aeson.String "RETENTION_SOURCE" -> pure FieldOptions'OptionRetention'RetentionSource
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldOptions'OptionRetention"

instance Hashable FieldOptions'OptionRetention where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldOptions'OptionRetention x)

-- | This indicates the types of entities that the field may apply to when used
-- as an option. If it is unset, then the field may be freely used as an
-- option on any kind of entity. Note: as of January 2023, support for this is
-- in progress and does not yet have an effect (b/264593489).
data FieldOptions'OptionTargetType
  = FieldOptions'OptionTargetType'TargetTypeUnknown
  | FieldOptions'OptionTargetType'TargetTypeFile
  | FieldOptions'OptionTargetType'TargetTypeExtensionRange
  | FieldOptions'OptionTargetType'TargetTypeMessage
  | FieldOptions'OptionTargetType'TargetTypeField
  | FieldOptions'OptionTargetType'TargetTypeOneof
  | FieldOptions'OptionTargetType'TargetTypeEnum
  | FieldOptions'OptionTargetType'TargetTypeEnumEntry
  | FieldOptions'OptionTargetType'TargetTypeService
  | FieldOptions'OptionTargetType'TargetTypeMethod
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFieldOptions'OptionTargetType :: FieldOptions'OptionTargetType -> Int
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeUnknown = 0
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeFile = 1
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeExtensionRange = 2
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeMessage = 3
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeField = 4
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeOneof = 5
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeEnum = 6
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeEnumEntry = 7
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeService = 8
toProtoEnumFieldOptions'OptionTargetType FieldOptions'OptionTargetType'TargetTypeMethod = 9

fromProtoEnumFieldOptions'OptionTargetType :: Int -> Maybe FieldOptions'OptionTargetType
fromProtoEnumFieldOptions'OptionTargetType 0 = Just FieldOptions'OptionTargetType'TargetTypeUnknown
fromProtoEnumFieldOptions'OptionTargetType 1 = Just FieldOptions'OptionTargetType'TargetTypeFile
fromProtoEnumFieldOptions'OptionTargetType 2 = Just FieldOptions'OptionTargetType'TargetTypeExtensionRange
fromProtoEnumFieldOptions'OptionTargetType 3 = Just FieldOptions'OptionTargetType'TargetTypeMessage
fromProtoEnumFieldOptions'OptionTargetType 4 = Just FieldOptions'OptionTargetType'TargetTypeField
fromProtoEnumFieldOptions'OptionTargetType 5 = Just FieldOptions'OptionTargetType'TargetTypeOneof
fromProtoEnumFieldOptions'OptionTargetType 6 = Just FieldOptions'OptionTargetType'TargetTypeEnum
fromProtoEnumFieldOptions'OptionTargetType 7 = Just FieldOptions'OptionTargetType'TargetTypeEnumEntry
fromProtoEnumFieldOptions'OptionTargetType 8 = Just FieldOptions'OptionTargetType'TargetTypeService
fromProtoEnumFieldOptions'OptionTargetType 9 = Just FieldOptions'OptionTargetType'TargetTypeMethod
fromProtoEnumFieldOptions'OptionTargetType _ = Nothing

instance MessageEncode FieldOptions'OptionTargetType where
  buildSized _ = mempty
instance MessageDecode FieldOptions'OptionTargetType where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FieldOptions'OptionTargetType where
  toJSON FieldOptions'OptionTargetType'TargetTypeUnknown = Aeson.String "TARGET_TYPE_UNKNOWN"
  toJSON FieldOptions'OptionTargetType'TargetTypeFile = Aeson.String "TARGET_TYPE_FILE"
  toJSON FieldOptions'OptionTargetType'TargetTypeExtensionRange = Aeson.String "TARGET_TYPE_EXTENSION_RANGE"
  toJSON FieldOptions'OptionTargetType'TargetTypeMessage = Aeson.String "TARGET_TYPE_MESSAGE"
  toJSON FieldOptions'OptionTargetType'TargetTypeField = Aeson.String "TARGET_TYPE_FIELD"
  toJSON FieldOptions'OptionTargetType'TargetTypeOneof = Aeson.String "TARGET_TYPE_ONEOF"
  toJSON FieldOptions'OptionTargetType'TargetTypeEnum = Aeson.String "TARGET_TYPE_ENUM"
  toJSON FieldOptions'OptionTargetType'TargetTypeEnumEntry = Aeson.String "TARGET_TYPE_ENUM_ENTRY"
  toJSON FieldOptions'OptionTargetType'TargetTypeService = Aeson.String "TARGET_TYPE_SERVICE"
  toJSON FieldOptions'OptionTargetType'TargetTypeMethod = Aeson.String "TARGET_TYPE_METHOD"

instance Aeson.FromJSON FieldOptions'OptionTargetType where
  parseJSON = \case
    Aeson.String "TARGET_TYPE_UNKNOWN" -> pure FieldOptions'OptionTargetType'TargetTypeUnknown
    Aeson.String "TARGET_TYPE_FILE" -> pure FieldOptions'OptionTargetType'TargetTypeFile
    Aeson.String "TARGET_TYPE_EXTENSION_RANGE" -> pure FieldOptions'OptionTargetType'TargetTypeExtensionRange
    Aeson.String "TARGET_TYPE_MESSAGE" -> pure FieldOptions'OptionTargetType'TargetTypeMessage
    Aeson.String "TARGET_TYPE_FIELD" -> pure FieldOptions'OptionTargetType'TargetTypeField
    Aeson.String "TARGET_TYPE_ONEOF" -> pure FieldOptions'OptionTargetType'TargetTypeOneof
    Aeson.String "TARGET_TYPE_ENUM" -> pure FieldOptions'OptionTargetType'TargetTypeEnum
    Aeson.String "TARGET_TYPE_ENUM_ENTRY" -> pure FieldOptions'OptionTargetType'TargetTypeEnumEntry
    Aeson.String "TARGET_TYPE_SERVICE" -> pure FieldOptions'OptionTargetType'TargetTypeService
    Aeson.String "TARGET_TYPE_METHOD" -> pure FieldOptions'OptionTargetType'TargetTypeMethod
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FieldOptions'OptionTargetType"

instance Hashable FieldOptions'OptionTargetType where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFieldOptions'OptionTargetType x)

data FieldOptions'EditionDefault = FieldOptions'EditionDefault
  { fieldOptionsEditionDefaultEdition :: !(Maybe Edition)
  , fieldOptionsEditionDefaultValue :: !(Maybe Text)
  , fieldOptionsEditionDefaultUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultFieldOptions'EditionDefault :: FieldOptions'EditionDefault
defaultFieldOptions'EditionDefault = FieldOptions'EditionDefault
  { fieldOptionsEditionDefaultEdition = Nothing
  , fieldOptionsEditionDefaultValue = Nothing
  , fieldOptionsEditionDefaultUnknownFields = []
  }

instance MessageEncode FieldOptions'EditionDefault where
  buildSized msg =
    (maybe mempty (\v -> archVarint 24 (fromIntegral (toProtoEnumEdition v))) msg.fieldOptionsEditionDefaultEdition)
    <> (maybe mempty (\v -> archString 18 v) msg.fieldOptionsEditionDefaultValue)
    <> encodeUnknownFieldsSized msg.fieldOptionsEditionDefaultUnknownFields

instance MessageDecode FieldOptions'EditionDefault where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFieldOptions'EditionDefault
    where
      stage_0 msg =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_1 (msg { fieldOptionsEditionDefaultEdition = (Just v)}))
          (pure (case msg.fieldOptionsEditionDefaultUnknownFields of { [] -> msg; _ -> msg { fieldOptionsEditionDefaultUnknownFields = reverse (msg.fieldOptionsEditionDefaultUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> loop (msg { fieldOptionsEditionDefaultValue = (Just v)}))
          (pure (case msg.fieldOptionsEditionDefaultUnknownFields of { [] -> msg; _ -> msg { fieldOptionsEditionDefaultUnknownFields = reverse (msg.fieldOptionsEditionDefaultUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.fieldOptionsEditionDefaultUnknownFields of { [] -> msg; _ -> msg { fieldOptionsEditionDefaultUnknownFields = reverse (msg.fieldOptionsEditionDefaultUnknownFields) } }))
        (\fn wt -> case fn of
          3 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsEditionDefaultEdition = (Just v)})
          2 -> do
            v <- decodeFieldString
            loop (msg { fieldOptionsEditionDefaultValue = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fieldOptionsEditionDefaultUnknownFields = (uf : msg.fieldOptionsEditionDefaultUnknownFields)}))

-- | Field descriptors for 'FieldOptions'EditionDefault', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fieldOptions'EditionDefaultFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FieldOptions'EditionDefault)
fieldOptions'EditionDefaultFieldDescriptors =
  IntMap.fromList
    [ (3, SomeField FieldDescriptor
        { fdName = "edition"
        , fdNumber = 3
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsEditionDefaultEdition
        , fdSet = \v m -> m { fieldOptionsEditionDefaultEdition = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "value"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsEditionDefaultValue
        , fdSet = \v m -> m { fieldOptionsEditionDefaultValue = v }
        })
    ]

instance ProtoMessage FieldOptions'EditionDefault where
  protoMessageName _ = "google.protobuf.FieldOptions.EditionDefault"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFieldOptions'EditionDefault
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fieldOptions'EditionDefaultFieldDescriptors

instance IsMessage FieldOptions'EditionDefault

instance Aeson.ToJSON FieldOptions'EditionDefault where
  toJSON msg = jsonObject
      [ "edition" .=: msg.fieldOptionsEditionDefaultEdition
      , "value" .=: msg.fieldOptionsEditionDefaultValue
      ]

instance Aeson.FromJSON FieldOptions'EditionDefault where
  parseJSON = Aeson.withObject "FieldOptions'EditionDefault" $ \obj -> do
    fld_fieldOptionsEditionDefaultEdition <- parseFieldMaybe obj "edition"
    fld_fieldOptionsEditionDefaultValue <- parseFieldMaybe obj "value"
    pure defaultFieldOptions'EditionDefault
      { fieldOptionsEditionDefaultEdition = maybe (fieldOptionsEditionDefaultEdition defaultFieldOptions'EditionDefault) id fld_fieldOptionsEditionDefaultEdition
      , fieldOptionsEditionDefaultValue = maybe (fieldOptionsEditionDefaultValue defaultFieldOptions'EditionDefault) id fld_fieldOptionsEditionDefaultValue
      }

instance Hashable FieldOptions'EditionDefault where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (salt) msg.fieldOptionsEditionDefaultEdition) msg.fieldOptionsEditionDefaultValue

instance Proto.Extension.HasExtensions FieldOptions'EditionDefault where
  messageUnknownFields = fieldOptionsEditionDefaultUnknownFields
  setMessageUnknownFields !ufs msg = msg { fieldOptionsEditionDefaultUnknownFields = ufs }

instance Semigroup FieldOptions'EditionDefault where
  a <> b = FieldOptions'EditionDefault
    { fieldOptionsEditionDefaultEdition = case b.fieldOptionsEditionDefaultEdition of { Nothing -> a.fieldOptionsEditionDefaultEdition; x -> x }
    , fieldOptionsEditionDefaultValue = case b.fieldOptionsEditionDefaultValue of { Nothing -> a.fieldOptionsEditionDefaultValue; x -> x }
    , fieldOptionsEditionDefaultUnknownFields = a.fieldOptionsEditionDefaultUnknownFields <> b.fieldOptionsEditionDefaultUnknownFields
    }

instance Monoid FieldOptions'EditionDefault where
  mempty = defaultFieldOptions'EditionDefault

-- | Information about the support window of a feature.
data FieldOptions'FeatureSupport = FieldOptions'FeatureSupport
  { fieldOptionsFeatureSupportEditionIntroduced :: !(Maybe Edition)
    -- ^ The edition that this feature was first available in.  In editions
    -- earlier than this one, the default assigned to EDITION_LEGACY will be
    -- used, and proto files will not be able to override it.
  , fieldOptionsFeatureSupportEditionDeprecated :: !(Maybe Edition)
    -- ^ The edition this feature becomes deprecated in.  Using this after this
    -- edition may trigger warnings.
  , fieldOptionsFeatureSupportDeprecationWarning :: !(Maybe Text)
    -- ^ The deprecation warning text if this feature is used after the edition it
    -- was marked deprecated in.
  , fieldOptionsFeatureSupportEditionRemoved :: !(Maybe Edition)
    -- ^ The edition this feature is no longer available in.  In editions after
    -- this one, the last default assigned will be used, and proto files will
    -- not be able to override it.
  , fieldOptionsFeatureSupportUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultFieldOptions'FeatureSupport :: FieldOptions'FeatureSupport
defaultFieldOptions'FeatureSupport = FieldOptions'FeatureSupport
  { fieldOptionsFeatureSupportEditionIntroduced = Nothing
  , fieldOptionsFeatureSupportEditionDeprecated = Nothing
  , fieldOptionsFeatureSupportDeprecationWarning = Nothing
  , fieldOptionsFeatureSupportEditionRemoved = Nothing
  , fieldOptionsFeatureSupportUnknownFields = []
  }

instance MessageEncode FieldOptions'FeatureSupport where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral (toProtoEnumEdition v))) msg.fieldOptionsFeatureSupportEditionIntroduced)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral (toProtoEnumEdition v))) msg.fieldOptionsFeatureSupportEditionDeprecated)
    <> (maybe mempty (\v -> archString 26 v) msg.fieldOptionsFeatureSupportDeprecationWarning)
    <> (maybe mempty (\v -> archVarint 32 (fromIntegral (toProtoEnumEdition v))) msg.fieldOptionsFeatureSupportEditionRemoved)
    <> encodeUnknownFieldsSized msg.fieldOptionsFeatureSupportUnknownFields

instance MessageDecode FieldOptions'FeatureSupport where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFieldOptions'FeatureSupport
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_1 (msg { fieldOptionsFeatureSupportEditionIntroduced = (Just v)}))
          (pure (case msg.fieldOptionsFeatureSupportUnknownFields of { [] -> msg; _ -> msg { fieldOptionsFeatureSupportUnknownFields = reverse (msg.fieldOptionsFeatureSupportUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_2 (msg { fieldOptionsFeatureSupportEditionDeprecated = (Just v)}))
          (pure (case msg.fieldOptionsFeatureSupportUnknownFields of { [] -> msg; _ -> msg { fieldOptionsFeatureSupportUnknownFields = reverse (msg.fieldOptionsFeatureSupportUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_3 (msg { fieldOptionsFeatureSupportDeprecationWarning = (Just v)}))
          (pure (case msg.fieldOptionsFeatureSupportUnknownFields of { [] -> msg; _ -> msg { fieldOptionsFeatureSupportUnknownFields = reverse (msg.fieldOptionsFeatureSupportUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> loop (msg { fieldOptionsFeatureSupportEditionRemoved = (Just v)}))
          (pure (case msg.fieldOptionsFeatureSupportUnknownFields of { [] -> msg; _ -> msg { fieldOptionsFeatureSupportUnknownFields = reverse (msg.fieldOptionsFeatureSupportUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.fieldOptionsFeatureSupportUnknownFields of { [] -> msg; _ -> msg { fieldOptionsFeatureSupportUnknownFields = reverse (msg.fieldOptionsFeatureSupportUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsFeatureSupportEditionIntroduced = (Just v)})
          2 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsFeatureSupportEditionDeprecated = (Just v)})
          3 -> do
            v <- decodeFieldString
            loop (msg { fieldOptionsFeatureSupportDeprecationWarning = (Just v)})
          4 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsFeatureSupportEditionRemoved = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fieldOptionsFeatureSupportUnknownFields = (uf : msg.fieldOptionsFeatureSupportUnknownFields)}))

-- | Field descriptors for 'FieldOptions'FeatureSupport', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fieldOptions'FeatureSupportFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FieldOptions'FeatureSupport)
fieldOptions'FeatureSupportFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "edition_introduced"
        , fdNumber = 1
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatureSupportEditionIntroduced
        , fdSet = \v m -> m { fieldOptionsFeatureSupportEditionIntroduced = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "edition_deprecated"
        , fdNumber = 2
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatureSupportEditionDeprecated
        , fdSet = \v m -> m { fieldOptionsFeatureSupportEditionDeprecated = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "deprecation_warning"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatureSupportDeprecationWarning
        , fdSet = \v m -> m { fieldOptionsFeatureSupportDeprecationWarning = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "edition_removed"
        , fdNumber = 4
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatureSupportEditionRemoved
        , fdSet = \v m -> m { fieldOptionsFeatureSupportEditionRemoved = v }
        })
    ]

instance ProtoMessage FieldOptions'FeatureSupport where
  protoMessageName _ = "google.protobuf.FieldOptions.FeatureSupport"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFieldOptions'FeatureSupport
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fieldOptions'FeatureSupportFieldDescriptors

instance IsMessage FieldOptions'FeatureSupport

instance Aeson.ToJSON FieldOptions'FeatureSupport where
  toJSON msg = jsonObject
      [ "editionIntroduced" .=: msg.fieldOptionsFeatureSupportEditionIntroduced
      , "editionDeprecated" .=: msg.fieldOptionsFeatureSupportEditionDeprecated
      , "deprecationWarning" .=: msg.fieldOptionsFeatureSupportDeprecationWarning
      , "editionRemoved" .=: msg.fieldOptionsFeatureSupportEditionRemoved
      ]

instance Aeson.FromJSON FieldOptions'FeatureSupport where
  parseJSON = Aeson.withObject "FieldOptions'FeatureSupport" $ \obj -> do
    fld_fieldOptionsFeatureSupportEditionIntroduced <- parseFieldMaybe obj "editionIntroduced"
    fld_fieldOptionsFeatureSupportEditionDeprecated <- parseFieldMaybe obj "editionDeprecated"
    fld_fieldOptionsFeatureSupportDeprecationWarning <- parseFieldMaybe obj "deprecationWarning"
    fld_fieldOptionsFeatureSupportEditionRemoved <- parseFieldMaybe obj "editionRemoved"
    pure defaultFieldOptions'FeatureSupport
      { fieldOptionsFeatureSupportEditionIntroduced = maybe (fieldOptionsFeatureSupportEditionIntroduced defaultFieldOptions'FeatureSupport) id fld_fieldOptionsFeatureSupportEditionIntroduced
      , fieldOptionsFeatureSupportEditionDeprecated = maybe (fieldOptionsFeatureSupportEditionDeprecated defaultFieldOptions'FeatureSupport) id fld_fieldOptionsFeatureSupportEditionDeprecated
      , fieldOptionsFeatureSupportDeprecationWarning = maybe (fieldOptionsFeatureSupportDeprecationWarning defaultFieldOptions'FeatureSupport) id fld_fieldOptionsFeatureSupportDeprecationWarning
      , fieldOptionsFeatureSupportEditionRemoved = maybe (fieldOptionsFeatureSupportEditionRemoved defaultFieldOptions'FeatureSupport) id fld_fieldOptionsFeatureSupportEditionRemoved
      }

instance Hashable FieldOptions'FeatureSupport where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.fieldOptionsFeatureSupportEditionIntroduced) msg.fieldOptionsFeatureSupportEditionDeprecated) msg.fieldOptionsFeatureSupportDeprecationWarning) msg.fieldOptionsFeatureSupportEditionRemoved

instance Proto.Extension.HasExtensions FieldOptions'FeatureSupport where
  messageUnknownFields = fieldOptionsFeatureSupportUnknownFields
  setMessageUnknownFields !ufs msg = msg { fieldOptionsFeatureSupportUnknownFields = ufs }

instance Semigroup FieldOptions'FeatureSupport where
  a <> b = FieldOptions'FeatureSupport
    { fieldOptionsFeatureSupportEditionIntroduced = case b.fieldOptionsFeatureSupportEditionIntroduced of { Nothing -> a.fieldOptionsFeatureSupportEditionIntroduced; x -> x }
    , fieldOptionsFeatureSupportEditionDeprecated = case b.fieldOptionsFeatureSupportEditionDeprecated of { Nothing -> a.fieldOptionsFeatureSupportEditionDeprecated; x -> x }
    , fieldOptionsFeatureSupportDeprecationWarning = case b.fieldOptionsFeatureSupportDeprecationWarning of { Nothing -> a.fieldOptionsFeatureSupportDeprecationWarning; x -> x }
    , fieldOptionsFeatureSupportEditionRemoved = case b.fieldOptionsFeatureSupportEditionRemoved of { Nothing -> a.fieldOptionsFeatureSupportEditionRemoved; x -> x }
    , fieldOptionsFeatureSupportUnknownFields = a.fieldOptionsFeatureSupportUnknownFields <> b.fieldOptionsFeatureSupportUnknownFields
    }

instance Monoid FieldOptions'FeatureSupport where
  mempty = defaultFieldOptions'FeatureSupport

defaultFieldOptions :: FieldOptions
defaultFieldOptions = FieldOptions
  { fieldOptionsCtype = Nothing
  , fieldOptionsPacked = Nothing
  , fieldOptionsJstype = Nothing
  , fieldOptionsLazy = Nothing
  , fieldOptionsUnverifiedLazy = Nothing
  , fieldOptionsDeprecated = Nothing
  , fieldOptionsWeak = Nothing
  , fieldOptionsDebugRedact = Nothing
  , fieldOptionsRetention = Nothing
  , fieldOptionsTargets = V.empty
  , fieldOptionsEditionDefaults = V.empty
  , fieldOptionsFeatures = Nothing
  , fieldOptionsFeatureSupport = Nothing
  , fieldOptionsUninterpretedOption = V.empty
  , fieldOptionsUnknownFields = []
  }

instance MessageEncode FieldOptions where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral (toProtoEnumFieldOptions'CType v))) msg.fieldOptionsCtype)
    <> (maybe mempty (\v -> archBool 16 v) msg.fieldOptionsPacked)
    <> (maybe mempty (\v -> archVarint 48 (fromIntegral (toProtoEnumFieldOptions'JSType v))) msg.fieldOptionsJstype)
    <> (maybe mempty (\v -> archBool 40 v) msg.fieldOptionsLazy)
    <> (maybe mempty (\v -> archBool 120 v) msg.fieldOptionsUnverifiedLazy)
    <> (maybe mempty (\v -> archBool 24 v) msg.fieldOptionsDeprecated)
    <> (maybe mempty (\v -> archBool 80 v) msg.fieldOptionsWeak)
    <> (maybe mempty (\v -> archBool 128 v) msg.fieldOptionsDebugRedact)
    <> (maybe mempty (\v -> archVarint 136 (fromIntegral (toProtoEnumFieldOptions'OptionRetention v))) msg.fieldOptionsRetention)
    <> V.foldl' (\acc v -> acc <> archVarint 152 (fromIntegral (toProtoEnumFieldOptions'OptionTargetType v))) mempty msg.fieldOptionsTargets
    <> V.foldl' (\acc v -> acc <> archSubmessage 162 (buildSized v)) mempty msg.fieldOptionsEditionDefaults
    <> (maybe mempty (\v -> archSubmessage 170 (buildSized v)) msg.fieldOptionsFeatures)
    <> (maybe mempty (\v -> archSubmessage 178 (buildSized v)) msg.fieldOptionsFeatureSupport)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.fieldOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.fieldOptionsUnknownFields

instance MessageDecode FieldOptions where
  messageDecoder = stage_0 defaultFieldOptions emptyGrowList emptyGrowList
    where
      stage_0 msg gl_0 gl_1 =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_1 (msg { fieldOptionsCtype = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_1 msg gl_0 gl_1 =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_2 (msg { fieldOptionsPacked = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_2 msg gl_0 gl_1 =
        inOrderStage1
          (0x30 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_3 (msg { fieldOptionsJstype = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_3 msg gl_0 gl_1 =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_4 (msg { fieldOptionsLazy = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_4 msg gl_0 gl_1 =
        inOrderStage1
          (0x78 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_5 (msg { fieldOptionsUnverifiedLazy = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_5 msg gl_0 gl_1 =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_6 (msg { fieldOptionsDeprecated = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_6 msg gl_0 gl_1 =
        inOrderStage1
          (0x50 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_7 (msg { fieldOptionsWeak = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      stage_7 msg gl_0 gl_1 =
        inOrderStage
          0x180
          0xffff
          2
          decodeFieldBool
          (\v -> loop (msg { fieldOptionsDebugRedact = (Just v)}) gl_0 gl_1)
          (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
          (loop msg gl_0 gl_1)
      loop msg gl_0 gl_1 = withTagM
        (pure (case msg.fieldOptionsUnknownFields of { [] -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1 }; _ -> msg { fieldOptionsEditionDefaults = growListToVector gl_0, fieldOptionsUninterpretedOption = growListToVector gl_1, fieldOptionsUnknownFields = reverse (msg.fieldOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsCtype = (Just v)}) gl_0 gl_1
          2 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsPacked = (Just v)}) gl_0 gl_1
          6 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsJstype = (Just v)}) gl_0 gl_1
          5 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsLazy = (Just v)}) gl_0 gl_1
          15 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsUnverifiedLazy = (Just v)}) gl_0 gl_1
          3 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsDeprecated = (Just v)}) gl_0 gl_1
          10 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsWeak = (Just v)}) gl_0 gl_1
          16 -> do
            v <- decodeFieldBool
            loop (msg { fieldOptionsDebugRedact = (Just v)}) gl_0 gl_1
          17 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsRetention = (Just v)}) gl_0 gl_1
          19 -> do
            v <- decodeFieldEnum
            loop (msg { fieldOptionsTargets = (V.snoc msg.fieldOptionsTargets v)}) gl_0 gl_1
          20 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v) gl_1
          21 -> do
            v <- decodeFieldMessage
            loop (msg { fieldOptionsFeatures = (Just v)}) gl_0 gl_1
          22 -> do
            v <- decodeFieldMessage
            loop (msg { fieldOptionsFeatureSupport = (Just v)}) gl_0 gl_1
          999 -> do
            v <- decodeFieldMessage
            loop msg gl_0 (snocGrowList gl_1 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { fieldOptionsUnknownFields = (uf : msg.fieldOptionsUnknownFields)}) gl_0 gl_1)

-- | Field descriptors for 'FieldOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
fieldOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FieldOptions)
fieldOptionsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "ctype"
        , fdNumber = 1
        , fdTypeDesc = MessageType "CType"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsCtype
        , fdSet = \v m -> m { fieldOptionsCtype = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "packed"
        , fdNumber = 2
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsPacked
        , fdSet = \v m -> m { fieldOptionsPacked = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "jstype"
        , fdNumber = 6
        , fdTypeDesc = MessageType "JSType"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsJstype
        , fdSet = \v m -> m { fieldOptionsJstype = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "lazy"
        , fdNumber = 5
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsLazy
        , fdSet = \v m -> m { fieldOptionsLazy = v }
        })
    , (15, SomeField FieldDescriptor
        { fdName = "unverified_lazy"
        , fdNumber = 15
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsUnverifiedLazy
        , fdSet = \v m -> m { fieldOptionsUnverifiedLazy = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 3
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsDeprecated
        , fdSet = \v m -> m { fieldOptionsDeprecated = v }
        })
    , (10, SomeField FieldDescriptor
        { fdName = "weak"
        , fdNumber = 10
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsWeak
        , fdSet = \v m -> m { fieldOptionsWeak = v }
        })
    , (16, SomeField FieldDescriptor
        { fdName = "debug_redact"
        , fdNumber = 16
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsDebugRedact
        , fdSet = \v m -> m { fieldOptionsDebugRedact = v }
        })
    , (17, SomeField FieldDescriptor
        { fdName = "retention"
        , fdNumber = 17
        , fdTypeDesc = MessageType "OptionRetention"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsRetention
        , fdSet = \v m -> m { fieldOptionsRetention = v }
        })
    , (19, SomeField FieldDescriptor
        { fdName = "targets"
        , fdNumber = 19
        , fdTypeDesc = MessageType "OptionTargetType"
        , fdLabel = LabelRepeated
        , fdGet = fieldOptionsTargets
        , fdSet = \v m -> m { fieldOptionsTargets = v }
        })
    , (20, SomeField FieldDescriptor
        { fdName = "edition_defaults"
        , fdNumber = 20
        , fdTypeDesc = MessageType "EditionDefault"
        , fdLabel = LabelRepeated
        , fdGet = fieldOptionsEditionDefaults
        , fdSet = \v m -> m { fieldOptionsEditionDefaults = v }
        })
    , (21, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 21
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatures
        , fdSet = \v m -> m { fieldOptionsFeatures = v }
        })
    , (22, SomeField FieldDescriptor
        { fdName = "feature_support"
        , fdNumber = 22
        , fdTypeDesc = MessageType "FeatureSupport"
        , fdLabel = LabelOptional
        , fdGet = fieldOptionsFeatureSupport
        , fdSet = \v m -> m { fieldOptionsFeatureSupport = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = fieldOptionsUninterpretedOption
        , fdSet = \v m -> m { fieldOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage FieldOptions where
  protoMessageName _ = "google.protobuf.FieldOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFieldOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = fieldOptionsFieldDescriptors

instance IsMessage FieldOptions

instance Aeson.ToJSON FieldOptions where
  toJSON msg = jsonObject
      [ "ctype" .=: msg.fieldOptionsCtype
      , "packed" .=: msg.fieldOptionsPacked
      , "jstype" .=: msg.fieldOptionsJstype
      , "lazy" .=: msg.fieldOptionsLazy
      , "unverifiedLazy" .=: msg.fieldOptionsUnverifiedLazy
      , "deprecated" .=: msg.fieldOptionsDeprecated
      , "weak" .=: msg.fieldOptionsWeak
      , "debugRedact" .=: msg.fieldOptionsDebugRedact
      , "retention" .=: msg.fieldOptionsRetention
      , "targets" .=: msg.fieldOptionsTargets
      , "editionDefaults" .=: msg.fieldOptionsEditionDefaults
      , "features" .=: msg.fieldOptionsFeatures
      , "featureSupport" .=: msg.fieldOptionsFeatureSupport
      , "uninterpretedOption" .=: msg.fieldOptionsUninterpretedOption
      ]

instance Aeson.FromJSON FieldOptions where
  parseJSON = Aeson.withObject "FieldOptions" $ \obj -> do
    fld_fieldOptionsCtype <- parseFieldMaybe obj "ctype"
    fld_fieldOptionsPacked <- parseFieldMaybe obj "packed"
    fld_fieldOptionsJstype <- parseFieldMaybe obj "jstype"
    fld_fieldOptionsLazy <- parseFieldMaybe obj "lazy"
    fld_fieldOptionsUnverifiedLazy <- parseFieldMaybe obj "unverifiedLazy"
    fld_fieldOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_fieldOptionsWeak <- parseFieldMaybe obj "weak"
    fld_fieldOptionsDebugRedact <- parseFieldMaybe obj "debugRedact"
    fld_fieldOptionsRetention <- parseFieldMaybe obj "retention"
    fld_fieldOptionsTargets <- parseFieldMaybe obj "targets"
    fld_fieldOptionsEditionDefaults <- parseFieldMaybe obj "editionDefaults"
    fld_fieldOptionsFeatures <- parseFieldMaybe obj "features"
    fld_fieldOptionsFeatureSupport <- parseFieldMaybe obj "featureSupport"
    fld_fieldOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultFieldOptions
      { fieldOptionsCtype = maybe (fieldOptionsCtype defaultFieldOptions) id fld_fieldOptionsCtype
      , fieldOptionsPacked = maybe (fieldOptionsPacked defaultFieldOptions) id fld_fieldOptionsPacked
      , fieldOptionsJstype = maybe (fieldOptionsJstype defaultFieldOptions) id fld_fieldOptionsJstype
      , fieldOptionsLazy = maybe (fieldOptionsLazy defaultFieldOptions) id fld_fieldOptionsLazy
      , fieldOptionsUnverifiedLazy = maybe (fieldOptionsUnverifiedLazy defaultFieldOptions) id fld_fieldOptionsUnverifiedLazy
      , fieldOptionsDeprecated = maybe (fieldOptionsDeprecated defaultFieldOptions) id fld_fieldOptionsDeprecated
      , fieldOptionsWeak = maybe (fieldOptionsWeak defaultFieldOptions) id fld_fieldOptionsWeak
      , fieldOptionsDebugRedact = maybe (fieldOptionsDebugRedact defaultFieldOptions) id fld_fieldOptionsDebugRedact
      , fieldOptionsRetention = maybe (fieldOptionsRetention defaultFieldOptions) id fld_fieldOptionsRetention
      , fieldOptionsTargets = maybe (fieldOptionsTargets defaultFieldOptions) id fld_fieldOptionsTargets
      , fieldOptionsEditionDefaults = maybe (fieldOptionsEditionDefaults defaultFieldOptions) id fld_fieldOptionsEditionDefaults
      , fieldOptionsFeatures = maybe (fieldOptionsFeatures defaultFieldOptions) id fld_fieldOptionsFeatures
      , fieldOptionsFeatureSupport = maybe (fieldOptionsFeatureSupport defaultFieldOptions) id fld_fieldOptionsFeatureSupport
      , fieldOptionsUninterpretedOption = maybe (fieldOptionsUninterpretedOption defaultFieldOptions) id fld_fieldOptionsUninterpretedOption
      }

instance Hashable FieldOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.fieldOptionsCtype) msg.fieldOptionsPacked) msg.fieldOptionsJstype) msg.fieldOptionsLazy) msg.fieldOptionsUnverifiedLazy) msg.fieldOptionsDeprecated) msg.fieldOptionsWeak) msg.fieldOptionsDebugRedact) msg.fieldOptionsRetention) msg.fieldOptionsTargets) msg.fieldOptionsEditionDefaults) msg.fieldOptionsFeatures) msg.fieldOptionsFeatureSupport) msg.fieldOptionsUninterpretedOption

instance Proto.Extension.HasExtensions FieldOptions where
  messageUnknownFields = fieldOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { fieldOptionsUnknownFields = ufs }

instance Semigroup FieldOptions where
  a <> b = FieldOptions
    { fieldOptionsCtype = case b.fieldOptionsCtype of { Nothing -> a.fieldOptionsCtype; x -> x }
    , fieldOptionsPacked = case b.fieldOptionsPacked of { Nothing -> a.fieldOptionsPacked; x -> x }
    , fieldOptionsJstype = case b.fieldOptionsJstype of { Nothing -> a.fieldOptionsJstype; x -> x }
    , fieldOptionsLazy = case b.fieldOptionsLazy of { Nothing -> a.fieldOptionsLazy; x -> x }
    , fieldOptionsUnverifiedLazy = case b.fieldOptionsUnverifiedLazy of { Nothing -> a.fieldOptionsUnverifiedLazy; x -> x }
    , fieldOptionsDeprecated = case b.fieldOptionsDeprecated of { Nothing -> a.fieldOptionsDeprecated; x -> x }
    , fieldOptionsWeak = case b.fieldOptionsWeak of { Nothing -> a.fieldOptionsWeak; x -> x }
    , fieldOptionsDebugRedact = case b.fieldOptionsDebugRedact of { Nothing -> a.fieldOptionsDebugRedact; x -> x }
    , fieldOptionsRetention = case b.fieldOptionsRetention of { Nothing -> a.fieldOptionsRetention; x -> x }
    , fieldOptionsTargets = a.fieldOptionsTargets <> b.fieldOptionsTargets
    , fieldOptionsEditionDefaults = a.fieldOptionsEditionDefaults <> b.fieldOptionsEditionDefaults
    , fieldOptionsFeatures = case b.fieldOptionsFeatures of { Nothing -> a.fieldOptionsFeatures; x -> x }
    , fieldOptionsFeatureSupport = case b.fieldOptionsFeatureSupport of { Nothing -> a.fieldOptionsFeatureSupport; x -> x }
    , fieldOptionsUninterpretedOption = a.fieldOptionsUninterpretedOption <> b.fieldOptionsUninterpretedOption
    , fieldOptionsUnknownFields = a.fieldOptionsUnknownFields <> b.fieldOptionsUnknownFields
    }

instance Monoid FieldOptions where
  mempty = defaultFieldOptions

data OneofOptions = OneofOptions
  { oneofOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , oneofOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , oneofOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultOneofOptions :: OneofOptions
defaultOneofOptions = OneofOptions
  { oneofOptionsFeatures = Nothing
  , oneofOptionsUninterpretedOption = V.empty
  , oneofOptionsUnknownFields = []
  }

instance MessageEncode OneofOptions where
  buildSized msg =
    (maybe mempty (\v -> archSubmessage 10 (buildSized v)) msg.oneofOptionsFeatures)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.oneofOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.oneofOptionsUnknownFields

instance MessageDecode OneofOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultOneofOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_1 (msg { oneofOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.oneofOptionsUnknownFields of { [] -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0, oneofOptionsUnknownFields = reverse (msg.oneofOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_1 msg (snocGrowList gl_0 v))
          (pure (case msg.oneofOptionsUnknownFields of { [] -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0, oneofOptionsUnknownFields = reverse (msg.oneofOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.oneofOptionsUnknownFields of { [] -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { oneofOptionsUninterpretedOption = growListToVector gl_0, oneofOptionsUnknownFields = reverse (msg.oneofOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldMessage
            loop (msg { oneofOptionsFeatures = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { oneofOptionsUnknownFields = (uf : msg.oneofOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'OneofOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
oneofOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor OneofOptions)
oneofOptionsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 1
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = oneofOptionsFeatures
        , fdSet = \v m -> m { oneofOptionsFeatures = v }
        }), (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = oneofOptionsUninterpretedOption
        , fdSet = \v m -> m { oneofOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage OneofOptions where
  protoMessageName _ = "google.protobuf.OneofOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultOneofOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = oneofOptionsFieldDescriptors

instance IsMessage OneofOptions

instance Aeson.ToJSON OneofOptions where
  toJSON msg = jsonObject
      [ "features" .=: msg.oneofOptionsFeatures
      , "uninterpretedOption" .=: msg.oneofOptionsUninterpretedOption
      ]

instance Aeson.FromJSON OneofOptions where
  parseJSON = Aeson.withObject "OneofOptions" $ \obj -> do
    fld_oneofOptionsFeatures <- parseFieldMaybe obj "features"
    fld_oneofOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultOneofOptions
      { oneofOptionsFeatures = maybe (oneofOptionsFeatures defaultOneofOptions) id fld_oneofOptionsFeatures
      , oneofOptionsUninterpretedOption = maybe (oneofOptionsUninterpretedOption defaultOneofOptions) id fld_oneofOptionsUninterpretedOption
      }

instance Hashable OneofOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (salt) msg.oneofOptionsFeatures) msg.oneofOptionsUninterpretedOption

instance Proto.Extension.HasExtensions OneofOptions where
  messageUnknownFields = oneofOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { oneofOptionsUnknownFields = ufs }

instance Semigroup OneofOptions where
  a <> b = OneofOptions
    { oneofOptionsFeatures = case b.oneofOptionsFeatures of { Nothing -> a.oneofOptionsFeatures; x -> x }
    , oneofOptionsUninterpretedOption = a.oneofOptionsUninterpretedOption <> b.oneofOptionsUninterpretedOption
    , oneofOptionsUnknownFields = a.oneofOptionsUnknownFields <> b.oneofOptionsUnknownFields
    }

instance Monoid OneofOptions where
  mempty = defaultOneofOptions

data EnumOptions = EnumOptions
  { enumOptionsAllowAlias :: !(Maybe Bool)
    -- ^ Set this option to true to allow mapping different tag names to the same
    -- value.
  , enumOptionsDeprecated :: !(Maybe Bool)
    -- ^ Is this enum deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for the enum, or it will be completely ignored; in the very least, this
    -- is a formalization for deprecating enums.
  , enumOptionsDeprecatedLegacyJsonFieldConflicts :: !(Maybe Bool)
    -- ^ Enable the legacy handling of JSON field name conflicts.  This lowercases
    -- and strips underscored from the fields before comparison in proto3 only.
    -- The new behavior takes `json_name` into account and applies to proto2 as
    -- well.
    -- TODO Remove this legacy behavior once downstream teams have
    -- had time to migrate.
  , enumOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , enumOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , enumOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultEnumOptions :: EnumOptions
defaultEnumOptions = EnumOptions
  { enumOptionsAllowAlias = Nothing
  , enumOptionsDeprecated = Nothing
  , enumOptionsDeprecatedLegacyJsonFieldConflicts = Nothing
  , enumOptionsFeatures = Nothing
  , enumOptionsUninterpretedOption = V.empty
  , enumOptionsUnknownFields = []
  }

instance MessageEncode EnumOptions where
  buildSized msg =
    (maybe mempty (\v -> archBool 16 v) msg.enumOptionsAllowAlias)
    <> (maybe mempty (\v -> archBool 24 v) msg.enumOptionsDeprecated)
    <> (maybe mempty (\v -> archBool 48 v) msg.enumOptionsDeprecatedLegacyJsonFieldConflicts)
    <> (maybe mempty (\v -> archSubmessage 58 (buildSized v)) msg.enumOptionsFeatures)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.enumOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.enumOptionsUnknownFields

instance MessageDecode EnumOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultEnumOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_1 (msg { enumOptionsAllowAlias = (Just v)}) gl_0)
          (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_2 (msg { enumOptionsDeprecated = (Just v)}) gl_0)
          (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x30 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_3 (msg { enumOptionsDeprecatedLegacyJsonFieldConflicts = (Just v)}) gl_0)
          (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage1
          (0x3a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_4 (msg { enumOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_4 msg (snocGrowList gl_0 v))
          (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.enumOptionsUnknownFields of { [] -> msg { enumOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumOptionsUninterpretedOption = growListToVector gl_0, enumOptionsUnknownFields = reverse (msg.enumOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          2 -> do
            v <- decodeFieldBool
            loop (msg { enumOptionsAllowAlias = (Just v)}) gl_0
          3 -> do
            v <- decodeFieldBool
            loop (msg { enumOptionsDeprecated = (Just v)}) gl_0
          6 -> do
            v <- decodeFieldBool
            loop (msg { enumOptionsDeprecatedLegacyJsonFieldConflicts = (Just v)}) gl_0
          7 -> do
            v <- decodeFieldMessage
            loop (msg { enumOptionsFeatures = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { enumOptionsUnknownFields = (uf : msg.enumOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'EnumOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
enumOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor EnumOptions)
enumOptionsFieldDescriptors =
  IntMap.fromList
    [ (2, SomeField FieldDescriptor
        { fdName = "allow_alias"
        , fdNumber = 2
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = enumOptionsAllowAlias
        , fdSet = \v m -> m { enumOptionsAllowAlias = v }
        }), (3, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 3
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = enumOptionsDeprecated
        , fdSet = \v m -> m { enumOptionsDeprecated = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "deprecated_legacy_json_field_conflicts"
        , fdNumber = 6
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = enumOptionsDeprecatedLegacyJsonFieldConflicts
        , fdSet = \v m -> m { enumOptionsDeprecatedLegacyJsonFieldConflicts = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 7
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = enumOptionsFeatures
        , fdSet = \v m -> m { enumOptionsFeatures = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = enumOptionsUninterpretedOption
        , fdSet = \v m -> m { enumOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage EnumOptions where
  protoMessageName _ = "google.protobuf.EnumOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultEnumOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = enumOptionsFieldDescriptors

instance IsMessage EnumOptions

instance Aeson.ToJSON EnumOptions where
  toJSON msg = jsonObject
      [ "allowAlias" .=: msg.enumOptionsAllowAlias
      , "deprecated" .=: msg.enumOptionsDeprecated
      , "deprecatedLegacyJsonFieldConflicts" .=: msg.enumOptionsDeprecatedLegacyJsonFieldConflicts
      , "features" .=: msg.enumOptionsFeatures
      , "uninterpretedOption" .=: msg.enumOptionsUninterpretedOption
      ]

instance Aeson.FromJSON EnumOptions where
  parseJSON = Aeson.withObject "EnumOptions" $ \obj -> do
    fld_enumOptionsAllowAlias <- parseFieldMaybe obj "allowAlias"
    fld_enumOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_enumOptionsDeprecatedLegacyJsonFieldConflicts <- parseFieldMaybe obj "deprecatedLegacyJsonFieldConflicts"
    fld_enumOptionsFeatures <- parseFieldMaybe obj "features"
    fld_enumOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultEnumOptions
      { enumOptionsAllowAlias = maybe (enumOptionsAllowAlias defaultEnumOptions) id fld_enumOptionsAllowAlias
      , enumOptionsDeprecated = maybe (enumOptionsDeprecated defaultEnumOptions) id fld_enumOptionsDeprecated
      , enumOptionsDeprecatedLegacyJsonFieldConflicts = maybe (enumOptionsDeprecatedLegacyJsonFieldConflicts defaultEnumOptions) id fld_enumOptionsDeprecatedLegacyJsonFieldConflicts
      , enumOptionsFeatures = maybe (enumOptionsFeatures defaultEnumOptions) id fld_enumOptionsFeatures
      , enumOptionsUninterpretedOption = maybe (enumOptionsUninterpretedOption defaultEnumOptions) id fld_enumOptionsUninterpretedOption
      }

instance Hashable EnumOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.enumOptionsAllowAlias) msg.enumOptionsDeprecated) msg.enumOptionsDeprecatedLegacyJsonFieldConflicts) msg.enumOptionsFeatures) msg.enumOptionsUninterpretedOption

instance Proto.Extension.HasExtensions EnumOptions where
  messageUnknownFields = enumOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { enumOptionsUnknownFields = ufs }

instance Semigroup EnumOptions where
  a <> b = EnumOptions
    { enumOptionsAllowAlias = case b.enumOptionsAllowAlias of { Nothing -> a.enumOptionsAllowAlias; x -> x }
    , enumOptionsDeprecated = case b.enumOptionsDeprecated of { Nothing -> a.enumOptionsDeprecated; x -> x }
    , enumOptionsDeprecatedLegacyJsonFieldConflicts = case b.enumOptionsDeprecatedLegacyJsonFieldConflicts of { Nothing -> a.enumOptionsDeprecatedLegacyJsonFieldConflicts; x -> x }
    , enumOptionsFeatures = case b.enumOptionsFeatures of { Nothing -> a.enumOptionsFeatures; x -> x }
    , enumOptionsUninterpretedOption = a.enumOptionsUninterpretedOption <> b.enumOptionsUninterpretedOption
    , enumOptionsUnknownFields = a.enumOptionsUnknownFields <> b.enumOptionsUnknownFields
    }

instance Monoid EnumOptions where
  mempty = defaultEnumOptions

data EnumValueOptions = EnumValueOptions
  { enumValueOptionsDeprecated :: !(Maybe Bool)
    -- ^ Is this enum value deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for the enum value, or it will be completely ignored; in the very least,
    -- this is a formalization for deprecating enum values.
  , enumValueOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , enumValueOptionsDebugRedact :: !(Maybe Bool)
    -- ^ Indicate that fields annotated with this enum value should not be printed
    -- out when using debug formats, e.g. when the field contains sensitive
    -- credentials.
  , enumValueOptionsFeatureSupport :: !(Maybe FieldOptions'FeatureSupport)
    -- ^ Information about the support window of a feature value.
  , enumValueOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , enumValueOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultEnumValueOptions :: EnumValueOptions
defaultEnumValueOptions = EnumValueOptions
  { enumValueOptionsDeprecated = Nothing
  , enumValueOptionsFeatures = Nothing
  , enumValueOptionsDebugRedact = Nothing
  , enumValueOptionsFeatureSupport = Nothing
  , enumValueOptionsUninterpretedOption = V.empty
  , enumValueOptionsUnknownFields = []
  }

instance MessageEncode EnumValueOptions where
  buildSized msg =
    (maybe mempty (\v -> archBool 8 v) msg.enumValueOptionsDeprecated)
    <> (maybe mempty (\v -> archSubmessage 18 (buildSized v)) msg.enumValueOptionsFeatures)
    <> (maybe mempty (\v -> archBool 24 v) msg.enumValueOptionsDebugRedact)
    <> (maybe mempty (\v -> archSubmessage 34 (buildSized v)) msg.enumValueOptionsFeatureSupport)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.enumValueOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.enumValueOptionsUnknownFields

instance MessageDecode EnumValueOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultEnumValueOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_1 (msg { enumValueOptionsDeprecated = (Just v)}) gl_0)
          (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_2 (msg { enumValueOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> stage_3 (msg { enumValueOptionsDebugRedact = (Just v)}) gl_0)
          (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_4 (msg { enumValueOptionsFeatureSupport = (Just v)}) gl_0)
          (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_4 msg (snocGrowList gl_0 v))
          (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.enumValueOptionsUnknownFields of { [] -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { enumValueOptionsUninterpretedOption = growListToVector gl_0, enumValueOptionsUnknownFields = reverse (msg.enumValueOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldBool
            loop (msg { enumValueOptionsDeprecated = (Just v)}) gl_0
          2 -> do
            v <- decodeFieldMessage
            loop (msg { enumValueOptionsFeatures = (Just v)}) gl_0
          3 -> do
            v <- decodeFieldBool
            loop (msg { enumValueOptionsDebugRedact = (Just v)}) gl_0
          4 -> do
            v <- decodeFieldMessage
            loop (msg { enumValueOptionsFeatureSupport = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { enumValueOptionsUnknownFields = (uf : msg.enumValueOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'EnumValueOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
enumValueOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor EnumValueOptions)
enumValueOptionsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 1
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = enumValueOptionsDeprecated
        , fdSet = \v m -> m { enumValueOptionsDeprecated = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 2
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = enumValueOptionsFeatures
        , fdSet = \v m -> m { enumValueOptionsFeatures = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "debug_redact"
        , fdNumber = 3
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = enumValueOptionsDebugRedact
        , fdSet = \v m -> m { enumValueOptionsDebugRedact = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "feature_support"
        , fdNumber = 4
        , fdTypeDesc = MessageType "FieldOptions.FeatureSupport"
        , fdLabel = LabelOptional
        , fdGet = enumValueOptionsFeatureSupport
        , fdSet = \v m -> m { enumValueOptionsFeatureSupport = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = enumValueOptionsUninterpretedOption
        , fdSet = \v m -> m { enumValueOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage EnumValueOptions where
  protoMessageName _ = "google.protobuf.EnumValueOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultEnumValueOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = enumValueOptionsFieldDescriptors

instance IsMessage EnumValueOptions

instance Aeson.ToJSON EnumValueOptions where
  toJSON msg = jsonObject
      [ "deprecated" .=: msg.enumValueOptionsDeprecated
      , "features" .=: msg.enumValueOptionsFeatures
      , "debugRedact" .=: msg.enumValueOptionsDebugRedact
      , "featureSupport" .=: msg.enumValueOptionsFeatureSupport
      , "uninterpretedOption" .=: msg.enumValueOptionsUninterpretedOption
      ]

instance Aeson.FromJSON EnumValueOptions where
  parseJSON = Aeson.withObject "EnumValueOptions" $ \obj -> do
    fld_enumValueOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_enumValueOptionsFeatures <- parseFieldMaybe obj "features"
    fld_enumValueOptionsDebugRedact <- parseFieldMaybe obj "debugRedact"
    fld_enumValueOptionsFeatureSupport <- parseFieldMaybe obj "featureSupport"
    fld_enumValueOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultEnumValueOptions
      { enumValueOptionsDeprecated = maybe (enumValueOptionsDeprecated defaultEnumValueOptions) id fld_enumValueOptionsDeprecated
      , enumValueOptionsFeatures = maybe (enumValueOptionsFeatures defaultEnumValueOptions) id fld_enumValueOptionsFeatures
      , enumValueOptionsDebugRedact = maybe (enumValueOptionsDebugRedact defaultEnumValueOptions) id fld_enumValueOptionsDebugRedact
      , enumValueOptionsFeatureSupport = maybe (enumValueOptionsFeatureSupport defaultEnumValueOptions) id fld_enumValueOptionsFeatureSupport
      , enumValueOptionsUninterpretedOption = maybe (enumValueOptionsUninterpretedOption defaultEnumValueOptions) id fld_enumValueOptionsUninterpretedOption
      }

instance Hashable EnumValueOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.enumValueOptionsDeprecated) msg.enumValueOptionsFeatures) msg.enumValueOptionsDebugRedact) msg.enumValueOptionsFeatureSupport) msg.enumValueOptionsUninterpretedOption

instance Proto.Extension.HasExtensions EnumValueOptions where
  messageUnknownFields = enumValueOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { enumValueOptionsUnknownFields = ufs }

instance Semigroup EnumValueOptions where
  a <> b = EnumValueOptions
    { enumValueOptionsDeprecated = case b.enumValueOptionsDeprecated of { Nothing -> a.enumValueOptionsDeprecated; x -> x }
    , enumValueOptionsFeatures = case b.enumValueOptionsFeatures of { Nothing -> a.enumValueOptionsFeatures; x -> x }
    , enumValueOptionsDebugRedact = case b.enumValueOptionsDebugRedact of { Nothing -> a.enumValueOptionsDebugRedact; x -> x }
    , enumValueOptionsFeatureSupport = case b.enumValueOptionsFeatureSupport of { Nothing -> a.enumValueOptionsFeatureSupport; x -> x }
    , enumValueOptionsUninterpretedOption = a.enumValueOptionsUninterpretedOption <> b.enumValueOptionsUninterpretedOption
    , enumValueOptionsUnknownFields = a.enumValueOptionsUnknownFields <> b.enumValueOptionsUnknownFields
    }

instance Monoid EnumValueOptions where
  mempty = defaultEnumValueOptions

data ServiceOptions = ServiceOptions
  { serviceOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , serviceOptionsDeprecated :: !(Maybe Bool)
    -- ^ Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
    --   framework.  We apologize for hoarding these numbers to ourselves, but
    --   we were already using them long before we decided to release Protocol
    --   Buffers.
    -- Is this service deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for the service, or it will be completely ignored; in the very least,
    -- this is a formalization for deprecating services.
  , serviceOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , serviceOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultServiceOptions :: ServiceOptions
defaultServiceOptions = ServiceOptions
  { serviceOptionsFeatures = Nothing
  , serviceOptionsDeprecated = Nothing
  , serviceOptionsUninterpretedOption = V.empty
  , serviceOptionsUnknownFields = []
  }

instance MessageEncode ServiceOptions where
  buildSized msg =
    (maybe mempty (\v -> archSubmessage 274 (buildSized v)) msg.serviceOptionsFeatures)
    <> (maybe mempty (\v -> archBool 264 v) msg.serviceOptionsDeprecated)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.serviceOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.serviceOptionsUnknownFields

instance MessageDecode ServiceOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultServiceOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage
          0x292
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_1 (msg { serviceOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.serviceOptionsUnknownFields of { [] -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0, serviceOptionsUnknownFields = reverse (msg.serviceOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage
          0x288
          0xffff
          2
          decodeFieldBool
          (\v -> stage_2 (msg { serviceOptionsDeprecated = (Just v)}) gl_0)
          (pure (case msg.serviceOptionsUnknownFields of { [] -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0, serviceOptionsUnknownFields = reverse (msg.serviceOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_2 msg (snocGrowList gl_0 v))
          (pure (case msg.serviceOptionsUnknownFields of { [] -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0, serviceOptionsUnknownFields = reverse (msg.serviceOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.serviceOptionsUnknownFields of { [] -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { serviceOptionsUninterpretedOption = growListToVector gl_0, serviceOptionsUnknownFields = reverse (msg.serviceOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          34 -> do
            v <- decodeFieldMessage
            loop (msg { serviceOptionsFeatures = (Just v)}) gl_0
          33 -> do
            v <- decodeFieldBool
            loop (msg { serviceOptionsDeprecated = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { serviceOptionsUnknownFields = (uf : msg.serviceOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'ServiceOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
serviceOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor ServiceOptions)
serviceOptionsFieldDescriptors =
  IntMap.fromList
    [ (34, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 34
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = serviceOptionsFeatures
        , fdSet = \v m -> m { serviceOptionsFeatures = v }
        }), (33, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 33
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = serviceOptionsDeprecated
        , fdSet = \v m -> m { serviceOptionsDeprecated = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = serviceOptionsUninterpretedOption
        , fdSet = \v m -> m { serviceOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage ServiceOptions where
  protoMessageName _ = "google.protobuf.ServiceOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultServiceOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = serviceOptionsFieldDescriptors

instance IsMessage ServiceOptions

instance Aeson.ToJSON ServiceOptions where
  toJSON msg = jsonObject
      [ "features" .=: msg.serviceOptionsFeatures
      , "deprecated" .=: msg.serviceOptionsDeprecated
      , "uninterpretedOption" .=: msg.serviceOptionsUninterpretedOption
      ]

instance Aeson.FromJSON ServiceOptions where
  parseJSON = Aeson.withObject "ServiceOptions" $ \obj -> do
    fld_serviceOptionsFeatures <- parseFieldMaybe obj "features"
    fld_serviceOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_serviceOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultServiceOptions
      { serviceOptionsFeatures = maybe (serviceOptionsFeatures defaultServiceOptions) id fld_serviceOptionsFeatures
      , serviceOptionsDeprecated = maybe (serviceOptionsDeprecated defaultServiceOptions) id fld_serviceOptionsDeprecated
      , serviceOptionsUninterpretedOption = maybe (serviceOptionsUninterpretedOption defaultServiceOptions) id fld_serviceOptionsUninterpretedOption
      }

instance Hashable ServiceOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.serviceOptionsFeatures) msg.serviceOptionsDeprecated) msg.serviceOptionsUninterpretedOption

instance Proto.Extension.HasExtensions ServiceOptions where
  messageUnknownFields = serviceOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { serviceOptionsUnknownFields = ufs }

instance Semigroup ServiceOptions where
  a <> b = ServiceOptions
    { serviceOptionsFeatures = case b.serviceOptionsFeatures of { Nothing -> a.serviceOptionsFeatures; x -> x }
    , serviceOptionsDeprecated = case b.serviceOptionsDeprecated of { Nothing -> a.serviceOptionsDeprecated; x -> x }
    , serviceOptionsUninterpretedOption = a.serviceOptionsUninterpretedOption <> b.serviceOptionsUninterpretedOption
    , serviceOptionsUnknownFields = a.serviceOptionsUnknownFields <> b.serviceOptionsUnknownFields
    }

instance Monoid ServiceOptions where
  mempty = defaultServiceOptions

data MethodOptions = MethodOptions
  { methodOptionsDeprecated :: !(Maybe Bool)
    -- ^ Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
    --   framework.  We apologize for hoarding these numbers to ourselves, but
    --   we were already using them long before we decided to release Protocol
    --   Buffers.
    -- Is this method deprecated?
    -- Depending on the target platform, this can emit Deprecated annotations
    -- for the method, or it will be completely ignored; in the very least,
    -- this is a formalization for deprecating methods.
  , methodOptionsIdempotencyLevel :: !(Maybe MethodOptions'IdempotencyLevel)
  , methodOptionsFeatures :: !(Maybe FeatureSet)
    -- ^ Any features defined in the specific edition.
  , methodOptionsUninterpretedOption :: !(V.Vector UninterpretedOption)
    -- ^ The parser stores options it doesn't recognize here. See above.
  , methodOptionsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
-- or neither? HTTP based RPC implementation may choose GET verb for safe
-- methods, and PUT verb for idempotent methods instead of the default POST.
data MethodOptions'IdempotencyLevel
  = MethodOptions'IdempotencyLevel'IdempotencyUnknown
  | MethodOptions'IdempotencyLevel'NoSideEffects
  | MethodOptions'IdempotencyLevel'Idempotent
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumMethodOptions'IdempotencyLevel :: MethodOptions'IdempotencyLevel -> Int
toProtoEnumMethodOptions'IdempotencyLevel MethodOptions'IdempotencyLevel'IdempotencyUnknown = 0
toProtoEnumMethodOptions'IdempotencyLevel MethodOptions'IdempotencyLevel'NoSideEffects = 1
toProtoEnumMethodOptions'IdempotencyLevel MethodOptions'IdempotencyLevel'Idempotent = 2

fromProtoEnumMethodOptions'IdempotencyLevel :: Int -> Maybe MethodOptions'IdempotencyLevel
fromProtoEnumMethodOptions'IdempotencyLevel 0 = Just MethodOptions'IdempotencyLevel'IdempotencyUnknown
fromProtoEnumMethodOptions'IdempotencyLevel 1 = Just MethodOptions'IdempotencyLevel'NoSideEffects
fromProtoEnumMethodOptions'IdempotencyLevel 2 = Just MethodOptions'IdempotencyLevel'Idempotent
fromProtoEnumMethodOptions'IdempotencyLevel _ = Nothing

instance MessageEncode MethodOptions'IdempotencyLevel where
  buildSized _ = mempty
instance MessageDecode MethodOptions'IdempotencyLevel where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON MethodOptions'IdempotencyLevel where
  toJSON MethodOptions'IdempotencyLevel'IdempotencyUnknown = Aeson.String "IDEMPOTENCY_UNKNOWN"
  toJSON MethodOptions'IdempotencyLevel'NoSideEffects = Aeson.String "NO_SIDE_EFFECTS"
  toJSON MethodOptions'IdempotencyLevel'Idempotent = Aeson.String "IDEMPOTENT"

instance Aeson.FromJSON MethodOptions'IdempotencyLevel where
  parseJSON = \case
    Aeson.String "IDEMPOTENCY_UNKNOWN" -> pure MethodOptions'IdempotencyLevel'IdempotencyUnknown
    Aeson.String "NO_SIDE_EFFECTS" -> pure MethodOptions'IdempotencyLevel'NoSideEffects
    Aeson.String "IDEMPOTENT" -> pure MethodOptions'IdempotencyLevel'Idempotent
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for MethodOptions'IdempotencyLevel"

instance Hashable MethodOptions'IdempotencyLevel where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumMethodOptions'IdempotencyLevel x)

defaultMethodOptions :: MethodOptions
defaultMethodOptions = MethodOptions
  { methodOptionsDeprecated = Nothing
  , methodOptionsIdempotencyLevel = Nothing
  , methodOptionsFeatures = Nothing
  , methodOptionsUninterpretedOption = V.empty
  , methodOptionsUnknownFields = []
  }

instance MessageEncode MethodOptions where
  buildSized msg =
    (maybe mempty (\v -> archBool 264 v) msg.methodOptionsDeprecated)
    <> (maybe mempty (\v -> archVarint 272 (fromIntegral (toProtoEnumMethodOptions'IdempotencyLevel v))) msg.methodOptionsIdempotencyLevel)
    <> (maybe mempty (\v -> archSubmessage 282 (buildSized v)) msg.methodOptionsFeatures)
    <> V.foldl' (\acc v -> acc <> archSubmessage 7994 (buildSized v)) mempty msg.methodOptionsUninterpretedOption
    <> encodeUnknownFieldsSized msg.methodOptionsUnknownFields

instance MessageDecode MethodOptions where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultMethodOptions emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage
          0x288
          0xffff
          2
          decodeFieldBool
          (\v -> stage_1 (msg { methodOptionsDeprecated = (Just v)}) gl_0)
          (pure (case msg.methodOptionsUnknownFields of { [] -> msg { methodOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { methodOptionsUninterpretedOption = growListToVector gl_0, methodOptionsUnknownFields = reverse (msg.methodOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage
          0x290
          0xffff
          2
          decodeFieldEnum
          (\v -> stage_2 (msg { methodOptionsIdempotencyLevel = (Just v)}) gl_0)
          (pure (case msg.methodOptionsUnknownFields of { [] -> msg { methodOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { methodOptionsUninterpretedOption = growListToVector gl_0, methodOptionsUnknownFields = reverse (msg.methodOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage
          0x29a
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_3 (msg { methodOptionsFeatures = (Just v)}) gl_0)
          (pure (case msg.methodOptionsUnknownFields of { [] -> msg { methodOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { methodOptionsUninterpretedOption = growListToVector gl_0, methodOptionsUnknownFields = reverse (msg.methodOptionsUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage
          0x3eba
          0xffff
          2
          decodeFieldMessage
          (\v -> stage_3 msg (snocGrowList gl_0 v))
          (pure (case msg.methodOptionsUnknownFields of { [] -> msg { methodOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { methodOptionsUninterpretedOption = growListToVector gl_0, methodOptionsUnknownFields = reverse (msg.methodOptionsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.methodOptionsUnknownFields of { [] -> msg { methodOptionsUninterpretedOption = growListToVector gl_0 }; _ -> msg { methodOptionsUninterpretedOption = growListToVector gl_0, methodOptionsUnknownFields = reverse (msg.methodOptionsUnknownFields) } }))
        (\fn wt -> case fn of
          33 -> do
            v <- decodeFieldBool
            loop (msg { methodOptionsDeprecated = (Just v)}) gl_0
          34 -> do
            v <- decodeFieldEnum
            loop (msg { methodOptionsIdempotencyLevel = (Just v)}) gl_0
          35 -> do
            v <- decodeFieldMessage
            loop (msg { methodOptionsFeatures = (Just v)}) gl_0
          999 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { methodOptionsUnknownFields = (uf : msg.methodOptionsUnknownFields)}) gl_0)

-- | Field descriptors for 'MethodOptions', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
methodOptionsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor MethodOptions)
methodOptionsFieldDescriptors =
  IntMap.fromList
    [ (33, SomeField FieldDescriptor
        { fdName = "deprecated"
        , fdNumber = 33
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelOptional
        , fdGet = methodOptionsDeprecated
        , fdSet = \v m -> m { methodOptionsDeprecated = v }
        }), (34, SomeField FieldDescriptor
        { fdName = "idempotency_level"
        , fdNumber = 34
        , fdTypeDesc = MessageType "IdempotencyLevel"
        , fdLabel = LabelOptional
        , fdGet = methodOptionsIdempotencyLevel
        , fdSet = \v m -> m { methodOptionsIdempotencyLevel = v }
        })
    , (35, SomeField FieldDescriptor
        { fdName = "features"
        , fdNumber = 35
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = methodOptionsFeatures
        , fdSet = \v m -> m { methodOptionsFeatures = v }
        })
    , (999, SomeField FieldDescriptor
        { fdName = "uninterpreted_option"
        , fdNumber = 999
        , fdTypeDesc = MessageType "UninterpretedOption"
        , fdLabel = LabelRepeated
        , fdGet = methodOptionsUninterpretedOption
        , fdSet = \v m -> m { methodOptionsUninterpretedOption = v }
        })
    ]

instance ProtoMessage MethodOptions where
  protoMessageName _ = "google.protobuf.MethodOptions"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultMethodOptions
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = methodOptionsFieldDescriptors

instance IsMessage MethodOptions

instance Aeson.ToJSON MethodOptions where
  toJSON msg = jsonObject
      [ "deprecated" .=: msg.methodOptionsDeprecated
      , "idempotencyLevel" .=: msg.methodOptionsIdempotencyLevel
      , "features" .=: msg.methodOptionsFeatures
      , "uninterpretedOption" .=: msg.methodOptionsUninterpretedOption
      ]

instance Aeson.FromJSON MethodOptions where
  parseJSON = Aeson.withObject "MethodOptions" $ \obj -> do
    fld_methodOptionsDeprecated <- parseFieldMaybe obj "deprecated"
    fld_methodOptionsIdempotencyLevel <- parseFieldMaybe obj "idempotencyLevel"
    fld_methodOptionsFeatures <- parseFieldMaybe obj "features"
    fld_methodOptionsUninterpretedOption <- parseFieldMaybe obj "uninterpretedOption"
    pure defaultMethodOptions
      { methodOptionsDeprecated = maybe (methodOptionsDeprecated defaultMethodOptions) id fld_methodOptionsDeprecated
      , methodOptionsIdempotencyLevel = maybe (methodOptionsIdempotencyLevel defaultMethodOptions) id fld_methodOptionsIdempotencyLevel
      , methodOptionsFeatures = maybe (methodOptionsFeatures defaultMethodOptions) id fld_methodOptionsFeatures
      , methodOptionsUninterpretedOption = maybe (methodOptionsUninterpretedOption defaultMethodOptions) id fld_methodOptionsUninterpretedOption
      }

instance Hashable MethodOptions where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.methodOptionsDeprecated) msg.methodOptionsIdempotencyLevel) msg.methodOptionsFeatures) msg.methodOptionsUninterpretedOption

instance Proto.Extension.HasExtensions MethodOptions where
  messageUnknownFields = methodOptionsUnknownFields
  setMessageUnknownFields !ufs msg = msg { methodOptionsUnknownFields = ufs }

instance Semigroup MethodOptions where
  a <> b = MethodOptions
    { methodOptionsDeprecated = case b.methodOptionsDeprecated of { Nothing -> a.methodOptionsDeprecated; x -> x }
    , methodOptionsIdempotencyLevel = case b.methodOptionsIdempotencyLevel of { Nothing -> a.methodOptionsIdempotencyLevel; x -> x }
    , methodOptionsFeatures = case b.methodOptionsFeatures of { Nothing -> a.methodOptionsFeatures; x -> x }
    , methodOptionsUninterpretedOption = a.methodOptionsUninterpretedOption <> b.methodOptionsUninterpretedOption
    , methodOptionsUnknownFields = a.methodOptionsUnknownFields <> b.methodOptionsUnknownFields
    }

instance Monoid MethodOptions where
  mempty = defaultMethodOptions

-- | A message representing a option the parser does not recognize. This only
-- appears in options protos created by the compiler::Parser class.
-- DescriptorPool resolves these when building Descriptor objects. Therefore,
-- options protos in descriptor objects (e.g. returned by Descriptor::options(),
-- or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
-- in them.
data UninterpretedOption = UninterpretedOption
  { uninterpretedOptionName :: !(V.Vector UninterpretedOption'NamePart)
  , uninterpretedOptionIdentifierValue :: !(Maybe Text)
    -- ^ The value of the uninterpreted option, in whatever type the tokenizer
    -- identified it as during parsing. Exactly one of these should be set.
  , uninterpretedOptionPositiveIntValue :: !(Maybe Word64)
  , uninterpretedOptionNegativeIntValue :: !(Maybe Int64)
  , uninterpretedOptionDoubleValue :: !(Maybe Double)
  , uninterpretedOptionStringValue :: !(Maybe ByteString)
  , uninterpretedOptionAggregateValue :: !(Maybe Text)
  , uninterpretedOptionUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | The name of the uninterpreted option.  Each string represents a segment in
-- a dot-separated name.  is_extension is true iff a segment represents an
-- extension (denoted with parentheses in options specs in .proto files).
-- E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
-- "foo.(bar.baz).moo".
data UninterpretedOption'NamePart = UninterpretedOption'NamePart
  { uninterpretedOptionNamePartNamePart :: !Text
  , uninterpretedOptionNamePartIsExtension :: !Bool
  , uninterpretedOptionNamePartUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultUninterpretedOption'NamePart :: UninterpretedOption'NamePart
defaultUninterpretedOption'NamePart = UninterpretedOption'NamePart
  { uninterpretedOptionNamePartNamePart = ""
  , uninterpretedOptionNamePartIsExtension = False
  , uninterpretedOptionNamePartUnknownFields = []
  }

instance MessageEncode UninterpretedOption'NamePart where
  buildSized msg =
    (if msg.uninterpretedOptionNamePartNamePart == T.empty then mempty else archString 10 msg.uninterpretedOptionNamePartNamePart)
    <> (if msg.uninterpretedOptionNamePartIsExtension == False then mempty else archBool 16 msg.uninterpretedOptionNamePartIsExtension)
    <> encodeUnknownFieldsSized msg.uninterpretedOptionNamePartUnknownFields

instance MessageDecode UninterpretedOption'NamePart where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultUninterpretedOption'NamePart
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_1 (msg { uninterpretedOptionNamePartNamePart = v}))
          (pure (case msg.uninterpretedOptionNamePartUnknownFields of { [] -> msg; _ -> msg { uninterpretedOptionNamePartUnknownFields = reverse (msg.uninterpretedOptionNamePartUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldBool
          (\v -> loop (msg { uninterpretedOptionNamePartIsExtension = v}))
          (pure (case msg.uninterpretedOptionNamePartUnknownFields of { [] -> msg; _ -> msg { uninterpretedOptionNamePartUnknownFields = reverse (msg.uninterpretedOptionNamePartUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.uninterpretedOptionNamePartUnknownFields of { [] -> msg; _ -> msg { uninterpretedOptionNamePartUnknownFields = reverse (msg.uninterpretedOptionNamePartUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldString
            loop (msg { uninterpretedOptionNamePartNamePart = v})
          2 -> do
            v <- decodeFieldBool
            loop (msg { uninterpretedOptionNamePartIsExtension = v})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { uninterpretedOptionNamePartUnknownFields = (uf : msg.uninterpretedOptionNamePartUnknownFields)}))

-- | Field descriptors for 'UninterpretedOption'NamePart', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
uninterpretedOption'NamePartFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor UninterpretedOption'NamePart)
uninterpretedOption'NamePartFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "name_part"
        , fdNumber = 1
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelRequired
        , fdGet = uninterpretedOptionNamePartNamePart
        , fdSet = \v m -> m { uninterpretedOptionNamePartNamePart = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "is_extension"
        , fdNumber = 2
        , fdTypeDesc = ScalarType BoolField
        , fdLabel = LabelRequired
        , fdGet = uninterpretedOptionNamePartIsExtension
        , fdSet = \v m -> m { uninterpretedOptionNamePartIsExtension = v }
        })
    ]

instance ProtoMessage UninterpretedOption'NamePart where
  protoMessageName _ = "google.protobuf.UninterpretedOption.NamePart"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultUninterpretedOption'NamePart
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = uninterpretedOption'NamePartFieldDescriptors

instance IsMessage UninterpretedOption'NamePart

instance Aeson.ToJSON UninterpretedOption'NamePart where
  toJSON msg = jsonObject
      [ "namePart" .=: msg.uninterpretedOptionNamePartNamePart
      , "isExtension" .=: msg.uninterpretedOptionNamePartIsExtension
      ]

instance Aeson.FromJSON UninterpretedOption'NamePart where
  parseJSON = Aeson.withObject "UninterpretedOption'NamePart" $ \obj -> do
    fld_uninterpretedOptionNamePartNamePart <- parseFieldMaybe obj "namePart"
    fld_uninterpretedOptionNamePartIsExtension <- parseFieldMaybe obj "isExtension"
    pure defaultUninterpretedOption'NamePart
      { uninterpretedOptionNamePartNamePart = maybe (uninterpretedOptionNamePartNamePart defaultUninterpretedOption'NamePart) id fld_uninterpretedOptionNamePartNamePart
      , uninterpretedOptionNamePartIsExtension = maybe (uninterpretedOptionNamePartIsExtension defaultUninterpretedOption'NamePart) id fld_uninterpretedOptionNamePartIsExtension
      }

instance Hashable UninterpretedOption'NamePart where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (salt) msg.uninterpretedOptionNamePartNamePart) msg.uninterpretedOptionNamePartIsExtension

instance Proto.Extension.HasExtensions UninterpretedOption'NamePart where
  messageUnknownFields = uninterpretedOptionNamePartUnknownFields
  setMessageUnknownFields !ufs msg = msg { uninterpretedOptionNamePartUnknownFields = ufs }

instance Semigroup UninterpretedOption'NamePart where
  a <> b = UninterpretedOption'NamePart
    { uninterpretedOptionNamePartNamePart = b.uninterpretedOptionNamePartNamePart
    , uninterpretedOptionNamePartIsExtension = b.uninterpretedOptionNamePartIsExtension
    , uninterpretedOptionNamePartUnknownFields = a.uninterpretedOptionNamePartUnknownFields <> b.uninterpretedOptionNamePartUnknownFields
    }

instance Monoid UninterpretedOption'NamePart where
  mempty = defaultUninterpretedOption'NamePart

defaultUninterpretedOption :: UninterpretedOption
defaultUninterpretedOption = UninterpretedOption
  { uninterpretedOptionName = V.empty
  , uninterpretedOptionIdentifierValue = Nothing
  , uninterpretedOptionPositiveIntValue = Nothing
  , uninterpretedOptionNegativeIntValue = Nothing
  , uninterpretedOptionDoubleValue = Nothing
  , uninterpretedOptionStringValue = Nothing
  , uninterpretedOptionAggregateValue = Nothing
  , uninterpretedOptionUnknownFields = []
  }

instance MessageEncode UninterpretedOption where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 18 (buildSized v)) mempty msg.uninterpretedOptionName
    <> (maybe mempty (\v -> archString 26 v) msg.uninterpretedOptionIdentifierValue)
    <> (maybe mempty (\v -> archVarint 32 v) msg.uninterpretedOptionPositiveIntValue)
    <> (maybe mempty (\v -> archVarint 40 (fromIntegral v)) msg.uninterpretedOptionNegativeIntValue)
    <> (maybe mempty (\v -> archDouble 49 v) msg.uninterpretedOptionDoubleValue)
    <> (maybe mempty (\v -> archBytes 58 v) msg.uninterpretedOptionStringValue)
    <> (maybe mempty (\v -> archString 66 v) msg.uninterpretedOptionAggregateValue)
    <> encodeUnknownFieldsSized msg.uninterpretedOptionUnknownFields

instance MessageDecode UninterpretedOption where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultUninterpretedOption emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v))
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { uninterpretedOptionIdentifierValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          decodeFieldVarint
          (\v -> stage_3 (msg { uninterpretedOptionPositiveIntValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_4 (msg { uninterpretedOptionNegativeIntValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage1
          (0x31 :: Data.Word.Word8)
          decodeFieldDouble
          (\v -> stage_5 (msg { uninterpretedOptionDoubleValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_5 msg gl_0 =
        inOrderStage1
          (0x3a :: Data.Word.Word8)
          decodeFieldBytes
          (\v -> stage_6 (msg { uninterpretedOptionStringValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      stage_6 msg gl_0 =
        inOrderStage1
          (0x42 :: Data.Word.Word8)
          decodeFieldString
          (\v -> loop (msg { uninterpretedOptionAggregateValue = (Just v)}) gl_0)
          (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.uninterpretedOptionUnknownFields of { [] -> msg { uninterpretedOptionName = growListToVector gl_0 }; _ -> msg { uninterpretedOptionName = growListToVector gl_0, uninterpretedOptionUnknownFields = reverse (msg.uninterpretedOptionUnknownFields) } }))
        (\fn wt -> case fn of
          2 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          3 -> do
            v <- decodeFieldString
            loop (msg { uninterpretedOptionIdentifierValue = (Just v)}) gl_0
          4 -> do
            v <- decodeFieldVarint
            loop (msg { uninterpretedOptionPositiveIntValue = (Just v)}) gl_0
          5 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { uninterpretedOptionNegativeIntValue = (Just v)}) gl_0
          6 -> do
            v <- decodeFieldDouble
            loop (msg { uninterpretedOptionDoubleValue = (Just v)}) gl_0
          7 -> do
            v <- decodeFieldBytes
            loop (msg { uninterpretedOptionStringValue = (Just v)}) gl_0
          8 -> do
            v <- decodeFieldString
            loop (msg { uninterpretedOptionAggregateValue = (Just v)}) gl_0
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { uninterpretedOptionUnknownFields = (uf : msg.uninterpretedOptionUnknownFields)}) gl_0)

-- | Field descriptors for 'UninterpretedOption', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
uninterpretedOptionFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor UninterpretedOption)
uninterpretedOptionFieldDescriptors =
  IntMap.fromList
    [ (2, SomeField FieldDescriptor
        { fdName = "name"
        , fdNumber = 2
        , fdTypeDesc = MessageType "NamePart"
        , fdLabel = LabelRepeated
        , fdGet = uninterpretedOptionName
        , fdSet = \v m -> m { uninterpretedOptionName = v }
        }), (3, SomeField FieldDescriptor
        { fdName = "identifier_value"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionIdentifierValue
        , fdSet = \v m -> m { uninterpretedOptionIdentifierValue = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "positive_int_value"
        , fdNumber = 4
        , fdTypeDesc = ScalarType UInt64Field
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionPositiveIntValue
        , fdSet = \v m -> m { uninterpretedOptionPositiveIntValue = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "negative_int_value"
        , fdNumber = 5
        , fdTypeDesc = ScalarType Int64Field
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionNegativeIntValue
        , fdSet = \v m -> m { uninterpretedOptionNegativeIntValue = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "double_value"
        , fdNumber = 6
        , fdTypeDesc = ScalarType DoubleField
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionDoubleValue
        , fdSet = \v m -> m { uninterpretedOptionDoubleValue = v }
        })
    , (7, SomeField FieldDescriptor
        { fdName = "string_value"
        , fdNumber = 7
        , fdTypeDesc = ScalarType BytesField
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionStringValue
        , fdSet = \v m -> m { uninterpretedOptionStringValue = v }
        })
    , (8, SomeField FieldDescriptor
        { fdName = "aggregate_value"
        , fdNumber = 8
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = uninterpretedOptionAggregateValue
        , fdSet = \v m -> m { uninterpretedOptionAggregateValue = v }
        })
    ]

instance ProtoMessage UninterpretedOption where
  protoMessageName _ = "google.protobuf.UninterpretedOption"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultUninterpretedOption
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = uninterpretedOptionFieldDescriptors

instance IsMessage UninterpretedOption

instance Aeson.ToJSON UninterpretedOption where
  toJSON msg = jsonObject
      [ "name" .=: msg.uninterpretedOptionName
      , "identifierValue" .=: msg.uninterpretedOptionIdentifierValue
      , "positiveIntValue" .=: msg.uninterpretedOptionPositiveIntValue
      , "negativeIntValue" .=: msg.uninterpretedOptionNegativeIntValue
      , "doubleValue" .=: msg.uninterpretedOptionDoubleValue
      , "stringValue" .=: (fmap protoBytesToJSON msg.uninterpretedOptionStringValue)
      , "aggregateValue" .=: msg.uninterpretedOptionAggregateValue
      ]

instance Aeson.FromJSON UninterpretedOption where
  parseJSON = Aeson.withObject "UninterpretedOption" $ \obj -> do
    fld_uninterpretedOptionName <- parseFieldMaybe obj "name"
    fld_uninterpretedOptionIdentifierValue <- parseFieldMaybe obj "identifierValue"
    fld_uninterpretedOptionPositiveIntValue <- parseFieldMaybe obj "positiveIntValue"
    fld_uninterpretedOptionNegativeIntValue <- parseFieldMaybe obj "negativeIntValue"
    fld_uninterpretedOptionDoubleValue <- parseFieldMaybe obj "doubleValue"
    fld_uninterpretedOptionStringValue <- parseBytesFieldMaybe obj "stringValue"
    fld_uninterpretedOptionAggregateValue <- parseFieldMaybe obj "aggregateValue"
    pure defaultUninterpretedOption
      { uninterpretedOptionName = maybe (uninterpretedOptionName defaultUninterpretedOption) id fld_uninterpretedOptionName
      , uninterpretedOptionIdentifierValue = maybe (uninterpretedOptionIdentifierValue defaultUninterpretedOption) id fld_uninterpretedOptionIdentifierValue
      , uninterpretedOptionPositiveIntValue = maybe (uninterpretedOptionPositiveIntValue defaultUninterpretedOption) id fld_uninterpretedOptionPositiveIntValue
      , uninterpretedOptionNegativeIntValue = maybe (uninterpretedOptionNegativeIntValue defaultUninterpretedOption) id fld_uninterpretedOptionNegativeIntValue
      , uninterpretedOptionDoubleValue = maybe (uninterpretedOptionDoubleValue defaultUninterpretedOption) id fld_uninterpretedOptionDoubleValue
      , uninterpretedOptionStringValue = fld_uninterpretedOptionStringValue
      , uninterpretedOptionAggregateValue = maybe (uninterpretedOptionAggregateValue defaultUninterpretedOption) id fld_uninterpretedOptionAggregateValue
      }

instance Hashable UninterpretedOption where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (salt) msg.uninterpretedOptionName) msg.uninterpretedOptionIdentifierValue) msg.uninterpretedOptionPositiveIntValue) msg.uninterpretedOptionNegativeIntValue) msg.uninterpretedOptionDoubleValue) msg.uninterpretedOptionStringValue) msg.uninterpretedOptionAggregateValue

instance Proto.Extension.HasExtensions UninterpretedOption where
  messageUnknownFields = uninterpretedOptionUnknownFields
  setMessageUnknownFields !ufs msg = msg { uninterpretedOptionUnknownFields = ufs }

instance Semigroup UninterpretedOption where
  a <> b = UninterpretedOption
    { uninterpretedOptionName = a.uninterpretedOptionName <> b.uninterpretedOptionName
    , uninterpretedOptionIdentifierValue = case b.uninterpretedOptionIdentifierValue of { Nothing -> a.uninterpretedOptionIdentifierValue; x -> x }
    , uninterpretedOptionPositiveIntValue = case b.uninterpretedOptionPositiveIntValue of { Nothing -> a.uninterpretedOptionPositiveIntValue; x -> x }
    , uninterpretedOptionNegativeIntValue = case b.uninterpretedOptionNegativeIntValue of { Nothing -> a.uninterpretedOptionNegativeIntValue; x -> x }
    , uninterpretedOptionDoubleValue = case b.uninterpretedOptionDoubleValue of { Nothing -> a.uninterpretedOptionDoubleValue; x -> x }
    , uninterpretedOptionStringValue = case b.uninterpretedOptionStringValue of { Nothing -> a.uninterpretedOptionStringValue; x -> x }
    , uninterpretedOptionAggregateValue = case b.uninterpretedOptionAggregateValue of { Nothing -> a.uninterpretedOptionAggregateValue; x -> x }
    , uninterpretedOptionUnknownFields = a.uninterpretedOptionUnknownFields <> b.uninterpretedOptionUnknownFields
    }

instance Monoid UninterpretedOption where
  mempty = defaultUninterpretedOption

-- | ===================================================================
-- Features
-- TODO Enums in C++ gencode (and potentially other languages) are
-- not well scoped.  This means that each of the feature enums below can clash
-- with each other.  The short names we've chosen maximize call-site
-- readability, but leave us very open to this scenario.  A future feature will
-- be designed and implemented to handle this, hopefully before we ever hit a
-- conflict here.
data FeatureSet = FeatureSet
  { featureSetFieldPresence :: !(Maybe FeatureSet'FieldPresence)
  , featureSetEnumType :: !(Maybe FeatureSet'EnumType)
  , featureSetRepeatedFieldEncoding :: !(Maybe FeatureSet'RepeatedFieldEncoding)
  , featureSetUtf8Validation :: !(Maybe FeatureSet'Utf8Validation)
  , featureSetMessageEncoding :: !(Maybe FeatureSet'MessageEncoding)
  , featureSetJsonFormat :: !(Maybe FeatureSet'JsonFormat)
  , featureSetUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data FeatureSet'FieldPresence
  = FeatureSet'FieldPresence'FieldPresenceUnknown
  | FeatureSet'FieldPresence'Explicit
  | FeatureSet'FieldPresence'Implicit
  | FeatureSet'FieldPresence'LegacyRequired
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'FieldPresence :: FeatureSet'FieldPresence -> Int
toProtoEnumFeatureSet'FieldPresence FeatureSet'FieldPresence'FieldPresenceUnknown = 0
toProtoEnumFeatureSet'FieldPresence FeatureSet'FieldPresence'Explicit = 1
toProtoEnumFeatureSet'FieldPresence FeatureSet'FieldPresence'Implicit = 2
toProtoEnumFeatureSet'FieldPresence FeatureSet'FieldPresence'LegacyRequired = 3

fromProtoEnumFeatureSet'FieldPresence :: Int -> Maybe FeatureSet'FieldPresence
fromProtoEnumFeatureSet'FieldPresence 0 = Just FeatureSet'FieldPresence'FieldPresenceUnknown
fromProtoEnumFeatureSet'FieldPresence 1 = Just FeatureSet'FieldPresence'Explicit
fromProtoEnumFeatureSet'FieldPresence 2 = Just FeatureSet'FieldPresence'Implicit
fromProtoEnumFeatureSet'FieldPresence 3 = Just FeatureSet'FieldPresence'LegacyRequired
fromProtoEnumFeatureSet'FieldPresence _ = Nothing

instance MessageEncode FeatureSet'FieldPresence where
  buildSized _ = mempty
instance MessageDecode FeatureSet'FieldPresence where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'FieldPresence where
  toJSON FeatureSet'FieldPresence'FieldPresenceUnknown = Aeson.String "FIELD_PRESENCE_UNKNOWN"
  toJSON FeatureSet'FieldPresence'Explicit = Aeson.String "EXPLICIT"
  toJSON FeatureSet'FieldPresence'Implicit = Aeson.String "IMPLICIT"
  toJSON FeatureSet'FieldPresence'LegacyRequired = Aeson.String "LEGACY_REQUIRED"

instance Aeson.FromJSON FeatureSet'FieldPresence where
  parseJSON = \case
    Aeson.String "FIELD_PRESENCE_UNKNOWN" -> pure FeatureSet'FieldPresence'FieldPresenceUnknown
    Aeson.String "EXPLICIT" -> pure FeatureSet'FieldPresence'Explicit
    Aeson.String "IMPLICIT" -> pure FeatureSet'FieldPresence'Implicit
    Aeson.String "LEGACY_REQUIRED" -> pure FeatureSet'FieldPresence'LegacyRequired
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'FieldPresence"

instance Hashable FeatureSet'FieldPresence where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'FieldPresence x)

data FeatureSet'EnumType
  = FeatureSet'EnumType'EnumTypeUnknown
  | FeatureSet'EnumType'Open
  | FeatureSet'EnumType'Closed
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'EnumType :: FeatureSet'EnumType -> Int
toProtoEnumFeatureSet'EnumType FeatureSet'EnumType'EnumTypeUnknown = 0
toProtoEnumFeatureSet'EnumType FeatureSet'EnumType'Open = 1
toProtoEnumFeatureSet'EnumType FeatureSet'EnumType'Closed = 2

fromProtoEnumFeatureSet'EnumType :: Int -> Maybe FeatureSet'EnumType
fromProtoEnumFeatureSet'EnumType 0 = Just FeatureSet'EnumType'EnumTypeUnknown
fromProtoEnumFeatureSet'EnumType 1 = Just FeatureSet'EnumType'Open
fromProtoEnumFeatureSet'EnumType 2 = Just FeatureSet'EnumType'Closed
fromProtoEnumFeatureSet'EnumType _ = Nothing

instance MessageEncode FeatureSet'EnumType where
  buildSized _ = mempty
instance MessageDecode FeatureSet'EnumType where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'EnumType where
  toJSON FeatureSet'EnumType'EnumTypeUnknown = Aeson.String "ENUM_TYPE_UNKNOWN"
  toJSON FeatureSet'EnumType'Open = Aeson.String "OPEN"
  toJSON FeatureSet'EnumType'Closed = Aeson.String "CLOSED"

instance Aeson.FromJSON FeatureSet'EnumType where
  parseJSON = \case
    Aeson.String "ENUM_TYPE_UNKNOWN" -> pure FeatureSet'EnumType'EnumTypeUnknown
    Aeson.String "OPEN" -> pure FeatureSet'EnumType'Open
    Aeson.String "CLOSED" -> pure FeatureSet'EnumType'Closed
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'EnumType"

instance Hashable FeatureSet'EnumType where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'EnumType x)

data FeatureSet'RepeatedFieldEncoding
  = FeatureSet'RepeatedFieldEncoding'RepeatedFieldEncodingUnknown
  | FeatureSet'RepeatedFieldEncoding'Packed
  | FeatureSet'RepeatedFieldEncoding'Expanded
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'RepeatedFieldEncoding :: FeatureSet'RepeatedFieldEncoding -> Int
toProtoEnumFeatureSet'RepeatedFieldEncoding FeatureSet'RepeatedFieldEncoding'RepeatedFieldEncodingUnknown = 0
toProtoEnumFeatureSet'RepeatedFieldEncoding FeatureSet'RepeatedFieldEncoding'Packed = 1
toProtoEnumFeatureSet'RepeatedFieldEncoding FeatureSet'RepeatedFieldEncoding'Expanded = 2

fromProtoEnumFeatureSet'RepeatedFieldEncoding :: Int -> Maybe FeatureSet'RepeatedFieldEncoding
fromProtoEnumFeatureSet'RepeatedFieldEncoding 0 = Just FeatureSet'RepeatedFieldEncoding'RepeatedFieldEncodingUnknown
fromProtoEnumFeatureSet'RepeatedFieldEncoding 1 = Just FeatureSet'RepeatedFieldEncoding'Packed
fromProtoEnumFeatureSet'RepeatedFieldEncoding 2 = Just FeatureSet'RepeatedFieldEncoding'Expanded
fromProtoEnumFeatureSet'RepeatedFieldEncoding _ = Nothing

instance MessageEncode FeatureSet'RepeatedFieldEncoding where
  buildSized _ = mempty
instance MessageDecode FeatureSet'RepeatedFieldEncoding where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'RepeatedFieldEncoding where
  toJSON FeatureSet'RepeatedFieldEncoding'RepeatedFieldEncodingUnknown = Aeson.String "REPEATED_FIELD_ENCODING_UNKNOWN"
  toJSON FeatureSet'RepeatedFieldEncoding'Packed = Aeson.String "PACKED"
  toJSON FeatureSet'RepeatedFieldEncoding'Expanded = Aeson.String "EXPANDED"

instance Aeson.FromJSON FeatureSet'RepeatedFieldEncoding where
  parseJSON = \case
    Aeson.String "REPEATED_FIELD_ENCODING_UNKNOWN" -> pure FeatureSet'RepeatedFieldEncoding'RepeatedFieldEncodingUnknown
    Aeson.String "PACKED" -> pure FeatureSet'RepeatedFieldEncoding'Packed
    Aeson.String "EXPANDED" -> pure FeatureSet'RepeatedFieldEncoding'Expanded
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'RepeatedFieldEncoding"

instance Hashable FeatureSet'RepeatedFieldEncoding where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'RepeatedFieldEncoding x)

data FeatureSet'Utf8Validation
  = FeatureSet'Utf8Validation'Utf8ValidationUnknown
  | FeatureSet'Utf8Validation'Verify
  | FeatureSet'Utf8Validation'None
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'Utf8Validation :: FeatureSet'Utf8Validation -> Int
toProtoEnumFeatureSet'Utf8Validation FeatureSet'Utf8Validation'Utf8ValidationUnknown = 0
toProtoEnumFeatureSet'Utf8Validation FeatureSet'Utf8Validation'Verify = 2
toProtoEnumFeatureSet'Utf8Validation FeatureSet'Utf8Validation'None = 3

fromProtoEnumFeatureSet'Utf8Validation :: Int -> Maybe FeatureSet'Utf8Validation
fromProtoEnumFeatureSet'Utf8Validation 0 = Just FeatureSet'Utf8Validation'Utf8ValidationUnknown
fromProtoEnumFeatureSet'Utf8Validation 2 = Just FeatureSet'Utf8Validation'Verify
fromProtoEnumFeatureSet'Utf8Validation 3 = Just FeatureSet'Utf8Validation'None
fromProtoEnumFeatureSet'Utf8Validation _ = Nothing

instance MessageEncode FeatureSet'Utf8Validation where
  buildSized _ = mempty
instance MessageDecode FeatureSet'Utf8Validation where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'Utf8Validation where
  toJSON FeatureSet'Utf8Validation'Utf8ValidationUnknown = Aeson.String "UTF8_VALIDATION_UNKNOWN"
  toJSON FeatureSet'Utf8Validation'Verify = Aeson.String "VERIFY"
  toJSON FeatureSet'Utf8Validation'None = Aeson.String "NONE"

instance Aeson.FromJSON FeatureSet'Utf8Validation where
  parseJSON = \case
    Aeson.String "UTF8_VALIDATION_UNKNOWN" -> pure FeatureSet'Utf8Validation'Utf8ValidationUnknown
    Aeson.String "VERIFY" -> pure FeatureSet'Utf8Validation'Verify
    Aeson.String "NONE" -> pure FeatureSet'Utf8Validation'None
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'Utf8Validation"

instance Hashable FeatureSet'Utf8Validation where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'Utf8Validation x)

data FeatureSet'MessageEncoding
  = FeatureSet'MessageEncoding'MessageEncodingUnknown
  | FeatureSet'MessageEncoding'LengthPrefixed
  | FeatureSet'MessageEncoding'Delimited
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'MessageEncoding :: FeatureSet'MessageEncoding -> Int
toProtoEnumFeatureSet'MessageEncoding FeatureSet'MessageEncoding'MessageEncodingUnknown = 0
toProtoEnumFeatureSet'MessageEncoding FeatureSet'MessageEncoding'LengthPrefixed = 1
toProtoEnumFeatureSet'MessageEncoding FeatureSet'MessageEncoding'Delimited = 2

fromProtoEnumFeatureSet'MessageEncoding :: Int -> Maybe FeatureSet'MessageEncoding
fromProtoEnumFeatureSet'MessageEncoding 0 = Just FeatureSet'MessageEncoding'MessageEncodingUnknown
fromProtoEnumFeatureSet'MessageEncoding 1 = Just FeatureSet'MessageEncoding'LengthPrefixed
fromProtoEnumFeatureSet'MessageEncoding 2 = Just FeatureSet'MessageEncoding'Delimited
fromProtoEnumFeatureSet'MessageEncoding _ = Nothing

instance MessageEncode FeatureSet'MessageEncoding where
  buildSized _ = mempty
instance MessageDecode FeatureSet'MessageEncoding where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'MessageEncoding where
  toJSON FeatureSet'MessageEncoding'MessageEncodingUnknown = Aeson.String "MESSAGE_ENCODING_UNKNOWN"
  toJSON FeatureSet'MessageEncoding'LengthPrefixed = Aeson.String "LENGTH_PREFIXED"
  toJSON FeatureSet'MessageEncoding'Delimited = Aeson.String "DELIMITED"

instance Aeson.FromJSON FeatureSet'MessageEncoding where
  parseJSON = \case
    Aeson.String "MESSAGE_ENCODING_UNKNOWN" -> pure FeatureSet'MessageEncoding'MessageEncodingUnknown
    Aeson.String "LENGTH_PREFIXED" -> pure FeatureSet'MessageEncoding'LengthPrefixed
    Aeson.String "DELIMITED" -> pure FeatureSet'MessageEncoding'Delimited
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'MessageEncoding"

instance Hashable FeatureSet'MessageEncoding where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'MessageEncoding x)

data FeatureSet'JsonFormat
  = FeatureSet'JsonFormat'JsonFormatUnknown
  | FeatureSet'JsonFormat'Allow
  | FeatureSet'JsonFormat'LegacyBestEffort
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumFeatureSet'JsonFormat :: FeatureSet'JsonFormat -> Int
toProtoEnumFeatureSet'JsonFormat FeatureSet'JsonFormat'JsonFormatUnknown = 0
toProtoEnumFeatureSet'JsonFormat FeatureSet'JsonFormat'Allow = 1
toProtoEnumFeatureSet'JsonFormat FeatureSet'JsonFormat'LegacyBestEffort = 2

fromProtoEnumFeatureSet'JsonFormat :: Int -> Maybe FeatureSet'JsonFormat
fromProtoEnumFeatureSet'JsonFormat 0 = Just FeatureSet'JsonFormat'JsonFormatUnknown
fromProtoEnumFeatureSet'JsonFormat 1 = Just FeatureSet'JsonFormat'Allow
fromProtoEnumFeatureSet'JsonFormat 2 = Just FeatureSet'JsonFormat'LegacyBestEffort
fromProtoEnumFeatureSet'JsonFormat _ = Nothing

instance MessageEncode FeatureSet'JsonFormat where
  buildSized _ = mempty
instance MessageDecode FeatureSet'JsonFormat where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON FeatureSet'JsonFormat where
  toJSON FeatureSet'JsonFormat'JsonFormatUnknown = Aeson.String "JSON_FORMAT_UNKNOWN"
  toJSON FeatureSet'JsonFormat'Allow = Aeson.String "ALLOW"
  toJSON FeatureSet'JsonFormat'LegacyBestEffort = Aeson.String "LEGACY_BEST_EFFORT"

instance Aeson.FromJSON FeatureSet'JsonFormat where
  parseJSON = \case
    Aeson.String "JSON_FORMAT_UNKNOWN" -> pure FeatureSet'JsonFormat'JsonFormatUnknown
    Aeson.String "ALLOW" -> pure FeatureSet'JsonFormat'Allow
    Aeson.String "LEGACY_BEST_EFFORT" -> pure FeatureSet'JsonFormat'LegacyBestEffort
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for FeatureSet'JsonFormat"

instance Hashable FeatureSet'JsonFormat where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumFeatureSet'JsonFormat x)

defaultFeatureSet :: FeatureSet
defaultFeatureSet = FeatureSet
  { featureSetFieldPresence = Nothing
  , featureSetEnumType = Nothing
  , featureSetRepeatedFieldEncoding = Nothing
  , featureSetUtf8Validation = Nothing
  , featureSetMessageEncoding = Nothing
  , featureSetJsonFormat = Nothing
  , featureSetUnknownFields = []
  }

instance MessageEncode FeatureSet where
  buildSized msg =
    (maybe mempty (\v -> archVarint 8 (fromIntegral (toProtoEnumFeatureSet'FieldPresence v))) msg.featureSetFieldPresence)
    <> (maybe mempty (\v -> archVarint 16 (fromIntegral (toProtoEnumFeatureSet'EnumType v))) msg.featureSetEnumType)
    <> (maybe mempty (\v -> archVarint 24 (fromIntegral (toProtoEnumFeatureSet'RepeatedFieldEncoding v))) msg.featureSetRepeatedFieldEncoding)
    <> (maybe mempty (\v -> archVarint 32 (fromIntegral (toProtoEnumFeatureSet'Utf8Validation v))) msg.featureSetUtf8Validation)
    <> (maybe mempty (\v -> archVarint 40 (fromIntegral (toProtoEnumFeatureSet'MessageEncoding v))) msg.featureSetMessageEncoding)
    <> (maybe mempty (\v -> archVarint 48 (fromIntegral (toProtoEnumFeatureSet'JsonFormat v))) msg.featureSetJsonFormat)
    <> encodeUnknownFieldsSized msg.featureSetUnknownFields

instance MessageDecode FeatureSet where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFeatureSet
    where
      stage_0 msg =
        inOrderStage1
          (0x8 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_1 (msg { featureSetFieldPresence = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x10 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_2 (msg { featureSetEnumType = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_3 (msg { featureSetRepeatedFieldEncoding = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_4 (msg { featureSetUtf8Validation = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      stage_4 msg =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_5 (msg { featureSetMessageEncoding = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      stage_5 msg =
        inOrderStage1
          (0x30 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> loop (msg { featureSetJsonFormat = (Just v)}))
          (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.featureSetUnknownFields of { [] -> msg; _ -> msg { featureSetUnknownFields = reverse (msg.featureSetUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetFieldPresence = (Just v)})
          2 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetEnumType = (Just v)})
          3 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetRepeatedFieldEncoding = (Just v)})
          4 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetUtf8Validation = (Just v)})
          5 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetMessageEncoding = (Just v)})
          6 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetJsonFormat = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { featureSetUnknownFields = (uf : msg.featureSetUnknownFields)}))

-- | Field descriptors for 'FeatureSet', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
featureSetFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FeatureSet)
featureSetFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "field_presence"
        , fdNumber = 1
        , fdTypeDesc = MessageType "FieldPresence"
        , fdLabel = LabelOptional
        , fdGet = featureSetFieldPresence
        , fdSet = \v m -> m { featureSetFieldPresence = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "enum_type"
        , fdNumber = 2
        , fdTypeDesc = MessageType "EnumType"
        , fdLabel = LabelOptional
        , fdGet = featureSetEnumType
        , fdSet = \v m -> m { featureSetEnumType = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "repeated_field_encoding"
        , fdNumber = 3
        , fdTypeDesc = MessageType "RepeatedFieldEncoding"
        , fdLabel = LabelOptional
        , fdGet = featureSetRepeatedFieldEncoding
        , fdSet = \v m -> m { featureSetRepeatedFieldEncoding = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "utf8_validation"
        , fdNumber = 4
        , fdTypeDesc = MessageType "Utf8Validation"
        , fdLabel = LabelOptional
        , fdGet = featureSetUtf8Validation
        , fdSet = \v m -> m { featureSetUtf8Validation = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "message_encoding"
        , fdNumber = 5
        , fdTypeDesc = MessageType "MessageEncoding"
        , fdLabel = LabelOptional
        , fdGet = featureSetMessageEncoding
        , fdSet = \v m -> m { featureSetMessageEncoding = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "json_format"
        , fdNumber = 6
        , fdTypeDesc = MessageType "JsonFormat"
        , fdLabel = LabelOptional
        , fdGet = featureSetJsonFormat
        , fdSet = \v m -> m { featureSetJsonFormat = v }
        })
    ]

instance ProtoMessage FeatureSet where
  protoMessageName _ = "google.protobuf.FeatureSet"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFeatureSet
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = featureSetFieldDescriptors

instance IsMessage FeatureSet

instance Aeson.ToJSON FeatureSet where
  toJSON msg = jsonObject
      [ "fieldPresence" .=: msg.featureSetFieldPresence
      , "enumType" .=: msg.featureSetEnumType
      , "repeatedFieldEncoding" .=: msg.featureSetRepeatedFieldEncoding
      , "utf8Validation" .=: msg.featureSetUtf8Validation
      , "messageEncoding" .=: msg.featureSetMessageEncoding
      , "jsonFormat" .=: msg.featureSetJsonFormat
      ]

instance Aeson.FromJSON FeatureSet where
  parseJSON = Aeson.withObject "FeatureSet" $ \obj -> do
    fld_featureSetFieldPresence <- parseFieldMaybe obj "fieldPresence"
    fld_featureSetEnumType <- parseFieldMaybe obj "enumType"
    fld_featureSetRepeatedFieldEncoding <- parseFieldMaybe obj "repeatedFieldEncoding"
    fld_featureSetUtf8Validation <- parseFieldMaybe obj "utf8Validation"
    fld_featureSetMessageEncoding <- parseFieldMaybe obj "messageEncoding"
    fld_featureSetJsonFormat <- parseFieldMaybe obj "jsonFormat"
    pure defaultFeatureSet
      { featureSetFieldPresence = maybe (featureSetFieldPresence defaultFeatureSet) id fld_featureSetFieldPresence
      , featureSetEnumType = maybe (featureSetEnumType defaultFeatureSet) id fld_featureSetEnumType
      , featureSetRepeatedFieldEncoding = maybe (featureSetRepeatedFieldEncoding defaultFeatureSet) id fld_featureSetRepeatedFieldEncoding
      , featureSetUtf8Validation = maybe (featureSetUtf8Validation defaultFeatureSet) id fld_featureSetUtf8Validation
      , featureSetMessageEncoding = maybe (featureSetMessageEncoding defaultFeatureSet) id fld_featureSetMessageEncoding
      , featureSetJsonFormat = maybe (featureSetJsonFormat defaultFeatureSet) id fld_featureSetJsonFormat
      }

instance Hashable FeatureSet where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.featureSetFieldPresence) msg.featureSetEnumType) msg.featureSetRepeatedFieldEncoding) msg.featureSetUtf8Validation) msg.featureSetMessageEncoding) msg.featureSetJsonFormat

instance Proto.Extension.HasExtensions FeatureSet where
  messageUnknownFields = featureSetUnknownFields
  setMessageUnknownFields !ufs msg = msg { featureSetUnknownFields = ufs }

instance Semigroup FeatureSet where
  a <> b = FeatureSet
    { featureSetFieldPresence = case b.featureSetFieldPresence of { Nothing -> a.featureSetFieldPresence; x -> x }
    , featureSetEnumType = case b.featureSetEnumType of { Nothing -> a.featureSetEnumType; x -> x }
    , featureSetRepeatedFieldEncoding = case b.featureSetRepeatedFieldEncoding of { Nothing -> a.featureSetRepeatedFieldEncoding; x -> x }
    , featureSetUtf8Validation = case b.featureSetUtf8Validation of { Nothing -> a.featureSetUtf8Validation; x -> x }
    , featureSetMessageEncoding = case b.featureSetMessageEncoding of { Nothing -> a.featureSetMessageEncoding; x -> x }
    , featureSetJsonFormat = case b.featureSetJsonFormat of { Nothing -> a.featureSetJsonFormat; x -> x }
    , featureSetUnknownFields = a.featureSetUnknownFields <> b.featureSetUnknownFields
    }

instance Monoid FeatureSet where
  mempty = defaultFeatureSet

-- | A compiled specification for the defaults of a set of features.  These
-- messages are generated from FeatureSet extensions and can be used to seed
-- feature resolution. The resolution with this object becomes a simple search
-- for the closest matching edition, followed by proto merges.
data FeatureSetDefaults = FeatureSetDefaults
  { featureSetDefaultsDefaults :: !(V.Vector FeatureSetDefaults'FeatureSetEditionDefault)
  , featureSetDefaultsMinimumEdition :: !(Maybe Edition)
    -- ^ The minimum supported edition (inclusive) when this was constructed.
    -- Editions before this will not have defaults.
  , featureSetDefaultsMaximumEdition :: !(Maybe Edition)
    -- ^ The maximum known edition (inclusive) when this was constructed. Editions
    -- after this will not have reliable defaults.
  , featureSetDefaultsUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | A map from every known edition with a unique set of defaults to its
-- defaults. Not all editions may be contained here.  For a given edition,
-- the defaults at the closest matching edition ordered at or before it should
-- be used.  This field must be in strict ascending order by edition.
data FeatureSetDefaults'FeatureSetEditionDefault = FeatureSetDefaults'FeatureSetEditionDefault
  { featureSetDefaultsFeatureSetEditionDefaultEdition :: !(Maybe Edition)
  , featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures :: !(Maybe FeatureSet)
    -- ^ Defaults of features that can be overridden in this edition.
  , featureSetDefaultsFeatureSetEditionDefaultFixedFeatures :: !(Maybe FeatureSet)
    -- ^ Defaults of features that can't be overridden in this edition.
  , featureSetDefaultsFeatureSetEditionDefaultUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultFeatureSetDefaults'FeatureSetEditionDefault :: FeatureSetDefaults'FeatureSetEditionDefault
defaultFeatureSetDefaults'FeatureSetEditionDefault = FeatureSetDefaults'FeatureSetEditionDefault
  { featureSetDefaultsFeatureSetEditionDefaultEdition = Nothing
  , featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = Nothing
  , featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = Nothing
  , featureSetDefaultsFeatureSetEditionDefaultUnknownFields = []
  }

instance MessageEncode FeatureSetDefaults'FeatureSetEditionDefault where
  buildSized msg =
    (maybe mempty (\v -> archVarint 24 (fromIntegral (toProtoEnumEdition v))) msg.featureSetDefaultsFeatureSetEditionDefaultEdition)
    <> (maybe mempty (\v -> archSubmessage 34 (buildSized v)) msg.featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures)
    <> (maybe mempty (\v -> archSubmessage 42 (buildSized v)) msg.featureSetDefaultsFeatureSetEditionDefaultFixedFeatures)
    <> encodeUnknownFieldsSized msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields

instance MessageDecode FeatureSetDefaults'FeatureSetEditionDefault where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFeatureSetDefaults'FeatureSetEditionDefault
    where
      stage_0 msg =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_1 (msg { featureSetDefaultsFeatureSetEditionDefaultEdition = (Just v)}))
          (pure (case msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields of { [] -> msg; _ -> msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = reverse (msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_2 (msg { featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = (Just v)}))
          (pure (case msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields of { [] -> msg; _ -> msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = reverse (msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x2a :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> loop (msg { featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = (Just v)}))
          (pure (case msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields of { [] -> msg; _ -> msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = reverse (msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields of { [] -> msg; _ -> msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = reverse (msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields) } }))
        (\fn wt -> case fn of
          3 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetDefaultsFeatureSetEditionDefaultEdition = (Just v)})
          4 -> do
            v <- decodeFieldMessage
            loop (msg { featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = (Just v)})
          5 -> do
            v <- decodeFieldMessage
            loop (msg { featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = (uf : msg.featureSetDefaultsFeatureSetEditionDefaultUnknownFields)}))

-- | Field descriptors for 'FeatureSetDefaults'FeatureSetEditionDefault', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
featureSetDefaults'FeatureSetEditionDefaultFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FeatureSetDefaults'FeatureSetEditionDefault)
featureSetDefaults'FeatureSetEditionDefaultFieldDescriptors =
  IntMap.fromList
    [ (3, SomeField FieldDescriptor
        { fdName = "edition"
        , fdNumber = 3
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = featureSetDefaultsFeatureSetEditionDefaultEdition
        , fdSet = \v m -> m { featureSetDefaultsFeatureSetEditionDefaultEdition = v }
        }), (4, SomeField FieldDescriptor
        { fdName = "overridable_features"
        , fdNumber = 4
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures
        , fdSet = \v m -> m { featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "fixed_features"
        , fdNumber = 5
        , fdTypeDesc = MessageType "FeatureSet"
        , fdLabel = LabelOptional
        , fdGet = featureSetDefaultsFeatureSetEditionDefaultFixedFeatures
        , fdSet = \v m -> m { featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = v }
        })
    ]

instance ProtoMessage FeatureSetDefaults'FeatureSetEditionDefault where
  protoMessageName _ = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFeatureSetDefaults'FeatureSetEditionDefault
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = featureSetDefaults'FeatureSetEditionDefaultFieldDescriptors

instance IsMessage FeatureSetDefaults'FeatureSetEditionDefault

instance Aeson.ToJSON FeatureSetDefaults'FeatureSetEditionDefault where
  toJSON msg = jsonObject
      [ "edition" .=: msg.featureSetDefaultsFeatureSetEditionDefaultEdition
      , "overridableFeatures" .=: msg.featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures
      , "fixedFeatures" .=: msg.featureSetDefaultsFeatureSetEditionDefaultFixedFeatures
      ]

instance Aeson.FromJSON FeatureSetDefaults'FeatureSetEditionDefault where
  parseJSON = Aeson.withObject "FeatureSetDefaults'FeatureSetEditionDefault" $ \obj -> do
    fld_featureSetDefaultsFeatureSetEditionDefaultEdition <- parseFieldMaybe obj "edition"
    fld_featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures <- parseFieldMaybe obj "overridableFeatures"
    fld_featureSetDefaultsFeatureSetEditionDefaultFixedFeatures <- parseFieldMaybe obj "fixedFeatures"
    pure defaultFeatureSetDefaults'FeatureSetEditionDefault
      { featureSetDefaultsFeatureSetEditionDefaultEdition = maybe (featureSetDefaultsFeatureSetEditionDefaultEdition defaultFeatureSetDefaults'FeatureSetEditionDefault) id fld_featureSetDefaultsFeatureSetEditionDefaultEdition
      , featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = maybe (featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures defaultFeatureSetDefaults'FeatureSetEditionDefault) id fld_featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures
      , featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = maybe (featureSetDefaultsFeatureSetEditionDefaultFixedFeatures defaultFeatureSetDefaults'FeatureSetEditionDefault) id fld_featureSetDefaultsFeatureSetEditionDefaultFixedFeatures
      }

instance Hashable FeatureSetDefaults'FeatureSetEditionDefault where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (salt) msg.featureSetDefaultsFeatureSetEditionDefaultEdition) msg.featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures) msg.featureSetDefaultsFeatureSetEditionDefaultFixedFeatures

instance Proto.Extension.HasExtensions FeatureSetDefaults'FeatureSetEditionDefault where
  messageUnknownFields = featureSetDefaultsFeatureSetEditionDefaultUnknownFields
  setMessageUnknownFields !ufs msg = msg { featureSetDefaultsFeatureSetEditionDefaultUnknownFields = ufs }

instance Semigroup FeatureSetDefaults'FeatureSetEditionDefault where
  a <> b = FeatureSetDefaults'FeatureSetEditionDefault
    { featureSetDefaultsFeatureSetEditionDefaultEdition = case b.featureSetDefaultsFeatureSetEditionDefaultEdition of { Nothing -> a.featureSetDefaultsFeatureSetEditionDefaultEdition; x -> x }
    , featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures = case b.featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures of { Nothing -> a.featureSetDefaultsFeatureSetEditionDefaultOverridableFeatures; x -> x }
    , featureSetDefaultsFeatureSetEditionDefaultFixedFeatures = case b.featureSetDefaultsFeatureSetEditionDefaultFixedFeatures of { Nothing -> a.featureSetDefaultsFeatureSetEditionDefaultFixedFeatures; x -> x }
    , featureSetDefaultsFeatureSetEditionDefaultUnknownFields = a.featureSetDefaultsFeatureSetEditionDefaultUnknownFields <> b.featureSetDefaultsFeatureSetEditionDefaultUnknownFields
    }

instance Monoid FeatureSetDefaults'FeatureSetEditionDefault where
  mempty = defaultFeatureSetDefaults'FeatureSetEditionDefault

defaultFeatureSetDefaults :: FeatureSetDefaults
defaultFeatureSetDefaults = FeatureSetDefaults
  { featureSetDefaultsDefaults = V.empty
  , featureSetDefaultsMinimumEdition = Nothing
  , featureSetDefaultsMaximumEdition = Nothing
  , featureSetDefaultsUnknownFields = []
  }

instance MessageEncode FeatureSetDefaults where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 10 (buildSized v)) mempty msg.featureSetDefaultsDefaults
    <> (maybe mempty (\v -> archVarint 32 (fromIntegral (toProtoEnumEdition v))) msg.featureSetDefaultsMinimumEdition)
    <> (maybe mempty (\v -> archVarint 40 (fromIntegral (toProtoEnumEdition v))) msg.featureSetDefaultsMaximumEdition)
    <> encodeUnknownFieldsSized msg.featureSetDefaultsUnknownFields

instance MessageDecode FeatureSetDefaults where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultFeatureSetDefaults emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v))
          (pure (case msg.featureSetDefaultsUnknownFields of { [] -> msg { featureSetDefaultsDefaults = growListToVector gl_0 }; _ -> msg { featureSetDefaultsDefaults = growListToVector gl_0, featureSetDefaultsUnknownFields = reverse (msg.featureSetDefaultsUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> stage_2 (msg { featureSetDefaultsMinimumEdition = (Just v)}) gl_0)
          (pure (case msg.featureSetDefaultsUnknownFields of { [] -> msg { featureSetDefaultsDefaults = growListToVector gl_0 }; _ -> msg { featureSetDefaultsDefaults = growListToVector gl_0, featureSetDefaultsUnknownFields = reverse (msg.featureSetDefaultsUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> loop (msg { featureSetDefaultsMaximumEdition = (Just v)}) gl_0)
          (pure (case msg.featureSetDefaultsUnknownFields of { [] -> msg { featureSetDefaultsDefaults = growListToVector gl_0 }; _ -> msg { featureSetDefaultsDefaults = growListToVector gl_0, featureSetDefaultsUnknownFields = reverse (msg.featureSetDefaultsUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.featureSetDefaultsUnknownFields of { [] -> msg { featureSetDefaultsDefaults = growListToVector gl_0 }; _ -> msg { featureSetDefaultsDefaults = growListToVector gl_0, featureSetDefaultsUnknownFields = reverse (msg.featureSetDefaultsUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          4 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetDefaultsMinimumEdition = (Just v)}) gl_0
          5 -> do
            v <- decodeFieldEnum
            loop (msg { featureSetDefaultsMaximumEdition = (Just v)}) gl_0
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { featureSetDefaultsUnknownFields = (uf : msg.featureSetDefaultsUnknownFields)}) gl_0)

-- | Field descriptors for 'FeatureSetDefaults', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
featureSetDefaultsFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor FeatureSetDefaults)
featureSetDefaultsFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "defaults"
        , fdNumber = 1
        , fdTypeDesc = MessageType "FeatureSetEditionDefault"
        , fdLabel = LabelRepeated
        , fdGet = featureSetDefaultsDefaults
        , fdSet = \v m -> m { featureSetDefaultsDefaults = v }
        }), (4, SomeField FieldDescriptor
        { fdName = "minimum_edition"
        , fdNumber = 4
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = featureSetDefaultsMinimumEdition
        , fdSet = \v m -> m { featureSetDefaultsMinimumEdition = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "maximum_edition"
        , fdNumber = 5
        , fdTypeDesc = MessageType "Edition"
        , fdLabel = LabelOptional
        , fdGet = featureSetDefaultsMaximumEdition
        , fdSet = \v m -> m { featureSetDefaultsMaximumEdition = v }
        })
    ]

instance ProtoMessage FeatureSetDefaults where
  protoMessageName _ = "google.protobuf.FeatureSetDefaults"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultFeatureSetDefaults
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = featureSetDefaultsFieldDescriptors

instance IsMessage FeatureSetDefaults

instance Aeson.ToJSON FeatureSetDefaults where
  toJSON msg = jsonObject
      [ "defaults" .=: msg.featureSetDefaultsDefaults
      , "minimumEdition" .=: msg.featureSetDefaultsMinimumEdition
      , "maximumEdition" .=: msg.featureSetDefaultsMaximumEdition
      ]

instance Aeson.FromJSON FeatureSetDefaults where
  parseJSON = Aeson.withObject "FeatureSetDefaults" $ \obj -> do
    fld_featureSetDefaultsDefaults <- parseFieldMaybe obj "defaults"
    fld_featureSetDefaultsMinimumEdition <- parseFieldMaybe obj "minimumEdition"
    fld_featureSetDefaultsMaximumEdition <- parseFieldMaybe obj "maximumEdition"
    pure defaultFeatureSetDefaults
      { featureSetDefaultsDefaults = maybe (featureSetDefaultsDefaults defaultFeatureSetDefaults) id fld_featureSetDefaultsDefaults
      , featureSetDefaultsMinimumEdition = maybe (featureSetDefaultsMinimumEdition defaultFeatureSetDefaults) id fld_featureSetDefaultsMinimumEdition
      , featureSetDefaultsMaximumEdition = maybe (featureSetDefaultsMaximumEdition defaultFeatureSetDefaults) id fld_featureSetDefaultsMaximumEdition
      }

instance Hashable FeatureSetDefaults where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (V.foldl' hashWithSalt (salt) msg.featureSetDefaultsDefaults) msg.featureSetDefaultsMinimumEdition) msg.featureSetDefaultsMaximumEdition

instance Proto.Extension.HasExtensions FeatureSetDefaults where
  messageUnknownFields = featureSetDefaultsUnknownFields
  setMessageUnknownFields !ufs msg = msg { featureSetDefaultsUnknownFields = ufs }

instance Semigroup FeatureSetDefaults where
  a <> b = FeatureSetDefaults
    { featureSetDefaultsDefaults = a.featureSetDefaultsDefaults <> b.featureSetDefaultsDefaults
    , featureSetDefaultsMinimumEdition = case b.featureSetDefaultsMinimumEdition of { Nothing -> a.featureSetDefaultsMinimumEdition; x -> x }
    , featureSetDefaultsMaximumEdition = case b.featureSetDefaultsMaximumEdition of { Nothing -> a.featureSetDefaultsMaximumEdition; x -> x }
    , featureSetDefaultsUnknownFields = a.featureSetDefaultsUnknownFields <> b.featureSetDefaultsUnknownFields
    }

instance Monoid FeatureSetDefaults where
  mempty = defaultFeatureSetDefaults

-- | ===================================================================
-- Optional source code info
-- Encapsulates information about the original source file from which a
-- FileDescriptorProto was generated.
data SourceCodeInfo = SourceCodeInfo
  { sourceCodeInfoLocation :: !(V.Vector SourceCodeInfo'Location)
    -- ^ A Location identifies a piece of source code in a .proto file which
    -- corresponds to a particular definition.  This information is intended
    -- to be useful to IDEs, code indexers, documentation generators, and similar
    -- tools.
    -- 
    -- For example, say we have a file like:
    --   message Foo {
    --     optional string foo = 1;
    --   }
    -- Let's look at just the field definition:
    --   optional string foo = 1;
    --   ^       ^^     ^^  ^  ^^^
    --   a       bc     de  f  ghi
    -- We have the following locations:
    --   span   path               represents
    --   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
    --   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
    --   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
    --   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
    --   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
    -- 
    -- Notes:
    -- - A location may refer to a repeated field itself (i.e. not to any
    --   particular index within it).  This is used whenever a set of elements are
    --   logically enclosed in a single code segment.  For example, an entire
    --   extend block (possibly containing multiple extension definitions) will
    --   have an outer location whose path refers to the "extensions" repeated
    --   field without an index.
    -- - Multiple locations may have the same path.  This happens when a single
    --   logical declaration is spread out across multiple places.  The most
    --   obvious example is the "extend" block again -- there may be multiple
    --   extend blocks in the same scope, each of which will have the same path.
    -- - A location's span is not always a subset of its parent's span.  For
    --   example, the "extendee" of an extension declaration appears at the
    --   beginning of the "extend" block and is shared by all extensions within
    --   the block.
    -- - Just because a location's span is a subset of some other location's span
    --   does not mean that it is a descendant.  For example, a "group" defines
    --   both a type and a field in a single declaration.  Thus, the locations
    --   corresponding to the type and field and their components will overlap.
    -- - Code which tries to interpret locations should probably be designed to
    --   ignore those that it doesn't understand, as more types of locations could
    --   be recorded in the future.
  , sourceCodeInfoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data SourceCodeInfo'Location = SourceCodeInfo'Location
  { sourceCodeInfoLocationPath :: !(VU.Vector Int32)
    -- ^ Identifies which part of the FileDescriptorProto was defined at this
    -- location.
    -- 
    -- Each element is a field number or an index.  They form a path from
    -- the root FileDescriptorProto to the place where the definition appears.
    -- For example, this path:
    --   [ 4, 3, 2, 7, 1 ]
    -- refers to:
    --   file.message_type(3)  // 4, 3
    --       .field(7)         // 2, 7
    --       .name()           // 1
    -- This is because FileDescriptorProto.message_type has field number 4:
    --   repeated DescriptorProto message_type = 4;
    -- and DescriptorProto.field has field number 2:
    --   repeated FieldDescriptorProto field = 2;
    -- and FieldDescriptorProto.name has field number 1:
    --   optional string name = 1;
    -- 
    -- Thus, the above path gives the location of a field name.  If we removed
    -- the last element:
    --   [ 4, 3, 2, 7 ]
    -- this path refers to the whole field declaration (from the beginning
    -- of the label to the terminating semicolon).
  , sourceCodeInfoLocationSpan :: !(VU.Vector Int32)
    -- ^ Always has exactly three or four elements: start line, start column,
    -- end line (optional, otherwise assumed same as start line), end column.
    -- These are packed into a single field for efficiency.  Note that line
    -- and column numbers are zero-based -- typically you will want to add
    -- 1 to each before displaying to a user.
  , sourceCodeInfoLocationLeadingComments :: !(Maybe Text)
    -- ^ If this SourceCodeInfo represents a complete declaration, these are any
    -- comments appearing before and after the declaration which appear to be
    -- attached to the declaration.
    -- 
    -- A series of line comments appearing on consecutive lines, with no other
    -- tokens appearing on those lines, will be treated as a single comment.
    -- 
    -- leading_detached_comments will keep paragraphs of comments that appear
    -- before (but not connected to) the current element. Each paragraph,
    -- separated by empty lines, will be one comment element in the repeated
    -- field.
    -- 
    -- Only the comment content is provided; comment markers (e.g. //) are
    -- stripped out.  For block comments, leading whitespace and an asterisk
    -- will be stripped from the beginning of each line other than the first.
    -- Newlines are included in the output.
    -- 
    -- Examples:
    -- 
    --   optional int32 foo = 1;  // Comment attached to foo.
    --   // Comment attached to bar.
    --   optional int32 bar = 2;
    -- 
    --   optional string baz = 3;
    --   // Comment attached to baz.
    --   // Another line attached to baz.
    -- 
    --   // Comment attached to moo.
    --   //
    --   // Another line attached to moo.
    --   optional double moo = 4;
    -- 
    --   // Detached comment for corge. This is not leading or trailing comments
    --   // to moo or corge because there are blank lines separating it from
    --   // both.
    -- 
    --   // Detached comment for corge paragraph 2.
    -- 
    --   optional string corge = 5;
    --   /* Block comment attached
    --    * to corge.  Leading asterisks
    --    * will be removed. */
    --   /* Block comment attached to
    --    * grault. */
    --   optional int32 grault = 6;
    -- 
    --   // ignored detached comments.
  , sourceCodeInfoLocationTrailingComments :: !(Maybe Text)
  , sourceCodeInfoLocationLeadingDetachedComments :: !(V.Vector Text)
  , sourceCodeInfoLocationUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

defaultSourceCodeInfo'Location :: SourceCodeInfo'Location
defaultSourceCodeInfo'Location = SourceCodeInfo'Location
  { sourceCodeInfoLocationPath = VU.empty
  , sourceCodeInfoLocationSpan = VU.empty
  , sourceCodeInfoLocationLeadingComments = Nothing
  , sourceCodeInfoLocationTrailingComments = Nothing
  , sourceCodeInfoLocationLeadingDetachedComments = V.empty
  , sourceCodeInfoLocationUnknownFields = []
  }

instance MessageEncode SourceCodeInfo'Location where
  buildSized msg =
    encodePackedInt32 1 msg.sourceCodeInfoLocationPath
    <> encodePackedInt32 2 msg.sourceCodeInfoLocationSpan
    <> (maybe mempty (\v -> archString 26 v) msg.sourceCodeInfoLocationLeadingComments)
    <> (maybe mempty (\v -> archString 34 v) msg.sourceCodeInfoLocationTrailingComments)
    <> V.foldl' (\acc v -> acc <> archString 50 v) mempty msg.sourceCodeInfoLocationLeadingDetachedComments
    <> encodeUnknownFieldsSized msg.sourceCodeInfoLocationUnknownFields

instance MessageDecode SourceCodeInfo'Location where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultSourceCodeInfo'Location emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          (VU.map fromIntegral <$> decodePackedVarint)
          (\v -> stage_1 (msg { sourceCodeInfoLocationPath = v}) gl_0)
          (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
          (loop msg gl_0)
      stage_1 msg gl_0 =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          (VU.map fromIntegral <$> decodePackedVarint)
          (\v -> stage_2 (msg { sourceCodeInfoLocationSpan = v}) gl_0)
          (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
          (loop msg gl_0)
      stage_2 msg gl_0 =
        inOrderStage1
          (0x1a :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_3 (msg { sourceCodeInfoLocationLeadingComments = (Just v)}) gl_0)
          (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
          (loop msg gl_0)
      stage_3 msg gl_0 =
        inOrderStage1
          (0x22 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_4 (msg { sourceCodeInfoLocationTrailingComments = (Just v)}) gl_0)
          (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
          (loop msg gl_0)
      stage_4 msg gl_0 =
        inOrderStage1
          (0x32 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_4 msg (snocGrowList gl_0 v))
          (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.sourceCodeInfoLocationUnknownFields of { [] -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocationLeadingDetachedComments = growListToVector gl_0, sourceCodeInfoLocationUnknownFields = reverse (msg.sourceCodeInfoLocationUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> case wt of
            2 -> do
              vs <- (VU.map fromIntegral <$> decodePackedVarint)
              loop (msg { sourceCodeInfoLocationPath = (msg.sourceCodeInfoLocationPath <> vs)}) gl_0
            _ -> do
              v <- (fromIntegral <$> decodeFieldVarint)
              loop (msg { sourceCodeInfoLocationPath = (VU.snoc msg.sourceCodeInfoLocationPath v)}) gl_0
          2 -> case wt of
            2 -> do
              vs <- (VU.map fromIntegral <$> decodePackedVarint)
              loop (msg { sourceCodeInfoLocationSpan = (msg.sourceCodeInfoLocationSpan <> vs)}) gl_0
            _ -> do
              v <- (fromIntegral <$> decodeFieldVarint)
              loop (msg { sourceCodeInfoLocationSpan = (VU.snoc msg.sourceCodeInfoLocationSpan v)}) gl_0
          3 -> do
            v <- decodeFieldString
            loop (msg { sourceCodeInfoLocationLeadingComments = (Just v)}) gl_0
          4 -> do
            v <- decodeFieldString
            loop (msg { sourceCodeInfoLocationTrailingComments = (Just v)}) gl_0
          6 -> do
            v <- decodeFieldString
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { sourceCodeInfoLocationUnknownFields = (uf : msg.sourceCodeInfoLocationUnknownFields)}) gl_0)

-- | Field descriptors for 'SourceCodeInfo'Location', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
sourceCodeInfo'LocationFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor SourceCodeInfo'Location)
sourceCodeInfo'LocationFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "path"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelRepeated
        , fdGet = sourceCodeInfoLocationPath
        , fdSet = \v m -> m { sourceCodeInfoLocationPath = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "span"
        , fdNumber = 2
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelRepeated
        , fdGet = sourceCodeInfoLocationSpan
        , fdSet = \v m -> m { sourceCodeInfoLocationSpan = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "leading_comments"
        , fdNumber = 3
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = sourceCodeInfoLocationLeadingComments
        , fdSet = \v m -> m { sourceCodeInfoLocationLeadingComments = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "trailing_comments"
        , fdNumber = 4
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = sourceCodeInfoLocationTrailingComments
        , fdSet = \v m -> m { sourceCodeInfoLocationTrailingComments = v }
        })
    , (6, SomeField FieldDescriptor
        { fdName = "leading_detached_comments"
        , fdNumber = 6
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelRepeated
        , fdGet = sourceCodeInfoLocationLeadingDetachedComments
        , fdSet = \v m -> m { sourceCodeInfoLocationLeadingDetachedComments = v }
        })
    ]

instance ProtoMessage SourceCodeInfo'Location where
  protoMessageName _ = "google.protobuf.SourceCodeInfo.Location"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultSourceCodeInfo'Location
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = sourceCodeInfo'LocationFieldDescriptors

instance IsMessage SourceCodeInfo'Location

instance Aeson.ToJSON SourceCodeInfo'Location where
  toJSON msg = jsonObject
      [ "path" .=: msg.sourceCodeInfoLocationPath
      , "span" .=: msg.sourceCodeInfoLocationSpan
      , "leadingComments" .=: msg.sourceCodeInfoLocationLeadingComments
      , "trailingComments" .=: msg.sourceCodeInfoLocationTrailingComments
      , "leadingDetachedComments" .=: msg.sourceCodeInfoLocationLeadingDetachedComments
      ]

instance Aeson.FromJSON SourceCodeInfo'Location where
  parseJSON = Aeson.withObject "SourceCodeInfo'Location" $ \obj -> do
    fld_sourceCodeInfoLocationPath <- parseFieldMaybe obj "path"
    fld_sourceCodeInfoLocationSpan <- parseFieldMaybe obj "span"
    fld_sourceCodeInfoLocationLeadingComments <- parseFieldMaybe obj "leadingComments"
    fld_sourceCodeInfoLocationTrailingComments <- parseFieldMaybe obj "trailingComments"
    fld_sourceCodeInfoLocationLeadingDetachedComments <- parseFieldMaybe obj "leadingDetachedComments"
    pure defaultSourceCodeInfo'Location
      { sourceCodeInfoLocationPath = maybe (sourceCodeInfoLocationPath defaultSourceCodeInfo'Location) id fld_sourceCodeInfoLocationPath
      , sourceCodeInfoLocationSpan = maybe (sourceCodeInfoLocationSpan defaultSourceCodeInfo'Location) id fld_sourceCodeInfoLocationSpan
      , sourceCodeInfoLocationLeadingComments = maybe (sourceCodeInfoLocationLeadingComments defaultSourceCodeInfo'Location) id fld_sourceCodeInfoLocationLeadingComments
      , sourceCodeInfoLocationTrailingComments = maybe (sourceCodeInfoLocationTrailingComments defaultSourceCodeInfo'Location) id fld_sourceCodeInfoLocationTrailingComments
      , sourceCodeInfoLocationLeadingDetachedComments = maybe (sourceCodeInfoLocationLeadingDetachedComments defaultSourceCodeInfo'Location) id fld_sourceCodeInfoLocationLeadingDetachedComments
      }

instance Hashable SourceCodeInfo'Location where
  hashWithSalt salt msg = V.foldl' hashWithSalt (hashWithSalt (hashWithSalt (VU.foldl' hashWithSalt (VU.foldl' hashWithSalt (salt) msg.sourceCodeInfoLocationPath) msg.sourceCodeInfoLocationSpan) msg.sourceCodeInfoLocationLeadingComments) msg.sourceCodeInfoLocationTrailingComments) msg.sourceCodeInfoLocationLeadingDetachedComments

instance Proto.Extension.HasExtensions SourceCodeInfo'Location where
  messageUnknownFields = sourceCodeInfoLocationUnknownFields
  setMessageUnknownFields !ufs msg = msg { sourceCodeInfoLocationUnknownFields = ufs }

instance Semigroup SourceCodeInfo'Location where
  a <> b = SourceCodeInfo'Location
    { sourceCodeInfoLocationPath = a.sourceCodeInfoLocationPath <> b.sourceCodeInfoLocationPath
    , sourceCodeInfoLocationSpan = a.sourceCodeInfoLocationSpan <> b.sourceCodeInfoLocationSpan
    , sourceCodeInfoLocationLeadingComments = case b.sourceCodeInfoLocationLeadingComments of { Nothing -> a.sourceCodeInfoLocationLeadingComments; x -> x }
    , sourceCodeInfoLocationTrailingComments = case b.sourceCodeInfoLocationTrailingComments of { Nothing -> a.sourceCodeInfoLocationTrailingComments; x -> x }
    , sourceCodeInfoLocationLeadingDetachedComments = a.sourceCodeInfoLocationLeadingDetachedComments <> b.sourceCodeInfoLocationLeadingDetachedComments
    , sourceCodeInfoLocationUnknownFields = a.sourceCodeInfoLocationUnknownFields <> b.sourceCodeInfoLocationUnknownFields
    }

instance Monoid SourceCodeInfo'Location where
  mempty = defaultSourceCodeInfo'Location

defaultSourceCodeInfo :: SourceCodeInfo
defaultSourceCodeInfo = SourceCodeInfo
  { sourceCodeInfoLocation = V.empty
  , sourceCodeInfoUnknownFields = []
  }

instance MessageEncode SourceCodeInfo where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 10 (buildSized v)) mempty msg.sourceCodeInfoLocation
    <> encodeUnknownFieldsSized msg.sourceCodeInfoUnknownFields

instance MessageDecode SourceCodeInfo where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultSourceCodeInfo emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v))
          (pure (case msg.sourceCodeInfoUnknownFields of { [] -> msg { sourceCodeInfoLocation = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocation = growListToVector gl_0, sourceCodeInfoUnknownFields = reverse (msg.sourceCodeInfoUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.sourceCodeInfoUnknownFields of { [] -> msg { sourceCodeInfoLocation = growListToVector gl_0 }; _ -> msg { sourceCodeInfoLocation = growListToVector gl_0, sourceCodeInfoUnknownFields = reverse (msg.sourceCodeInfoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { sourceCodeInfoUnknownFields = (uf : msg.sourceCodeInfoUnknownFields)}) gl_0)

-- | Field descriptors for 'SourceCodeInfo', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
sourceCodeInfoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor SourceCodeInfo)
sourceCodeInfoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "location"
        , fdNumber = 1
        , fdTypeDesc = MessageType "Location"
        , fdLabel = LabelRepeated
        , fdGet = sourceCodeInfoLocation
        , fdSet = \v m -> m { sourceCodeInfoLocation = v }
        })
    ]

instance ProtoMessage SourceCodeInfo where
  protoMessageName _ = "google.protobuf.SourceCodeInfo"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultSourceCodeInfo
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = sourceCodeInfoFieldDescriptors

instance IsMessage SourceCodeInfo

instance Aeson.ToJSON SourceCodeInfo where
  toJSON msg = jsonObject
      [ "location" .=: msg.sourceCodeInfoLocation

      ]

instance Aeson.FromJSON SourceCodeInfo where
  parseJSON = Aeson.withObject "SourceCodeInfo" $ \obj -> do
    fld_sourceCodeInfoLocation <- parseFieldMaybe obj "location"
    pure defaultSourceCodeInfo
      { sourceCodeInfoLocation = maybe (sourceCodeInfoLocation defaultSourceCodeInfo) id fld_sourceCodeInfoLocation
      }

instance Hashable SourceCodeInfo where
  hashWithSalt salt msg = V.foldl' hashWithSalt (salt) msg.sourceCodeInfoLocation

instance Proto.Extension.HasExtensions SourceCodeInfo where
  messageUnknownFields = sourceCodeInfoUnknownFields
  setMessageUnknownFields !ufs msg = msg { sourceCodeInfoUnknownFields = ufs }

instance Semigroup SourceCodeInfo where
  a <> b = SourceCodeInfo
    { sourceCodeInfoLocation = a.sourceCodeInfoLocation <> b.sourceCodeInfoLocation
    , sourceCodeInfoUnknownFields = a.sourceCodeInfoUnknownFields <> b.sourceCodeInfoUnknownFields
    }

instance Monoid SourceCodeInfo where
  mempty = defaultSourceCodeInfo

-- | Describes the relationship between generated code and its original source
-- file. A GeneratedCodeInfo message is associated with only one generated
-- source file, but may contain references to different source .proto files.
data GeneratedCodeInfo = GeneratedCodeInfo
  { generatedCodeInfoAnnotation :: !(V.Vector GeneratedCodeInfo'Annotation)
    -- ^ An Annotation connects some span of text in generated code to an element
    -- of its generating .proto file.
  , generatedCodeInfoUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

data GeneratedCodeInfo'Annotation = GeneratedCodeInfo'Annotation
  { generatedCodeInfoAnnotationPath :: !(VU.Vector Int32)
    -- ^ Identifies the element in the original source .proto file. This field
    -- is formatted the same as SourceCodeInfo.Location.path.
  , generatedCodeInfoAnnotationSourceFile :: !(Maybe Text)
    -- ^ Identifies the filesystem path to the original source .proto.
  , generatedCodeInfoAnnotationBegin :: !(Maybe Int32)
    -- ^ Identifies the starting offset in bytes in the generated code
    -- that relates to the identified object.
  , generatedCodeInfoAnnotationEnd :: !(Maybe Int32)
    -- ^ Identifies the ending offset in bytes in the generated code that
    -- relates to the identified object. The end offset should be one past
    -- the last relevant byte (so the length of the text = end - begin).
  , generatedCodeInfoAnnotationSemantic :: !(Maybe GeneratedCodeInfo'Annotation'Semantic)
  , generatedCodeInfoAnnotationUnknownFields :: ![UnknownField]
  }
  deriving stock (Show, Eq, Generic)
  deriving anyclass NFData

-- | Represents the identified object's effect on the element in the original
-- .proto file.
data GeneratedCodeInfo'Annotation'Semantic
  = GeneratedCodeInfo'Annotation'Semantic'None
    -- ^ There is no effect or the effect is indescribable.
  | GeneratedCodeInfo'Annotation'Semantic'Set
    -- ^ The element is set or otherwise mutated.
  | GeneratedCodeInfo'Annotation'Semantic'Alias
    -- ^ An alias to the element is returned.
  deriving stock (Show, Eq, Ord, Prelude.Enum, Prelude.Bounded, Generic)
  deriving anyclass NFData

toProtoEnumGeneratedCodeInfo'Annotation'Semantic :: GeneratedCodeInfo'Annotation'Semantic -> Int
toProtoEnumGeneratedCodeInfo'Annotation'Semantic GeneratedCodeInfo'Annotation'Semantic'None = 0
toProtoEnumGeneratedCodeInfo'Annotation'Semantic GeneratedCodeInfo'Annotation'Semantic'Set = 1
toProtoEnumGeneratedCodeInfo'Annotation'Semantic GeneratedCodeInfo'Annotation'Semantic'Alias = 2

fromProtoEnumGeneratedCodeInfo'Annotation'Semantic :: Int -> Maybe GeneratedCodeInfo'Annotation'Semantic
fromProtoEnumGeneratedCodeInfo'Annotation'Semantic 0 = Just GeneratedCodeInfo'Annotation'Semantic'None
fromProtoEnumGeneratedCodeInfo'Annotation'Semantic 1 = Just GeneratedCodeInfo'Annotation'Semantic'Set
fromProtoEnumGeneratedCodeInfo'Annotation'Semantic 2 = Just GeneratedCodeInfo'Annotation'Semantic'Alias
fromProtoEnumGeneratedCodeInfo'Annotation'Semantic _ = Nothing

instance MessageEncode GeneratedCodeInfo'Annotation'Semantic where
  buildSized _ = mempty
instance MessageDecode GeneratedCodeInfo'Annotation'Semantic where
  messageDecoder = pure (Prelude.toEnum 0)

instance Aeson.ToJSON GeneratedCodeInfo'Annotation'Semantic where
  toJSON GeneratedCodeInfo'Annotation'Semantic'None = Aeson.String "NONE"
  toJSON GeneratedCodeInfo'Annotation'Semantic'Set = Aeson.String "SET"
  toJSON GeneratedCodeInfo'Annotation'Semantic'Alias = Aeson.String "ALIAS"

instance Aeson.FromJSON GeneratedCodeInfo'Annotation'Semantic where
  parseJSON = \case
    Aeson.String "NONE" -> pure GeneratedCodeInfo'Annotation'Semantic'None
    Aeson.String "SET" -> pure GeneratedCodeInfo'Annotation'Semantic'Set
    Aeson.String "ALIAS" -> pure GeneratedCodeInfo'Annotation'Semantic'Alias
    Aeson.Number n -> pure (Prelude.toEnum (round n))
    _ -> fail "Invalid enum value for GeneratedCodeInfo'Annotation'Semantic"

instance Hashable GeneratedCodeInfo'Annotation'Semantic where
  hashWithSalt salt x = hashWithSalt salt (toProtoEnumGeneratedCodeInfo'Annotation'Semantic x)

defaultGeneratedCodeInfo'Annotation :: GeneratedCodeInfo'Annotation
defaultGeneratedCodeInfo'Annotation = GeneratedCodeInfo'Annotation
  { generatedCodeInfoAnnotationPath = VU.empty
  , generatedCodeInfoAnnotationSourceFile = Nothing
  , generatedCodeInfoAnnotationBegin = Nothing
  , generatedCodeInfoAnnotationEnd = Nothing
  , generatedCodeInfoAnnotationSemantic = Nothing
  , generatedCodeInfoAnnotationUnknownFields = []
  }

instance MessageEncode GeneratedCodeInfo'Annotation where
  buildSized msg =
    encodePackedInt32 1 msg.generatedCodeInfoAnnotationPath
    <> (maybe mempty (\v -> archString 18 v) msg.generatedCodeInfoAnnotationSourceFile)
    <> (maybe mempty (\v -> archVarint 24 (fromIntegral v)) msg.generatedCodeInfoAnnotationBegin)
    <> (maybe mempty (\v -> archVarint 32 (fromIntegral v)) msg.generatedCodeInfoAnnotationEnd)
    <> (maybe mempty (\v -> archVarint 40 (fromIntegral (toProtoEnumGeneratedCodeInfo'Annotation'Semantic v))) msg.generatedCodeInfoAnnotationSemantic)
    <> encodeUnknownFieldsSized msg.generatedCodeInfoAnnotationUnknownFields

instance MessageDecode GeneratedCodeInfo'Annotation where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultGeneratedCodeInfo'Annotation
    where
      stage_0 msg =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          (VU.map fromIntegral <$> decodePackedVarint)
          (\v -> stage_1 (msg { generatedCodeInfoAnnotationPath = v}))
          (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
          (loop msg)
      stage_1 msg =
        inOrderStage1
          (0x12 :: Data.Word.Word8)
          decodeFieldString
          (\v -> stage_2 (msg { generatedCodeInfoAnnotationSourceFile = (Just v)}))
          (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
          (loop msg)
      stage_2 msg =
        inOrderStage1
          (0x18 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_3 (msg { generatedCodeInfoAnnotationBegin = (Just v)}))
          (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
          (loop msg)
      stage_3 msg =
        inOrderStage1
          (0x20 :: Data.Word.Word8)
          (fromIntegral <$> decodeFieldVarint)
          (\v -> stage_4 (msg { generatedCodeInfoAnnotationEnd = (Just v)}))
          (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
          (loop msg)
      stage_4 msg =
        inOrderStage1
          (0x28 :: Data.Word.Word8)
          decodeFieldEnum
          (\v -> loop (msg { generatedCodeInfoAnnotationSemantic = (Just v)}))
          (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
          (loop msg)
      loop msg = withTagM
        (pure (case msg.generatedCodeInfoAnnotationUnknownFields of { [] -> msg; _ -> msg { generatedCodeInfoAnnotationUnknownFields = reverse (msg.generatedCodeInfoAnnotationUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> case wt of
            2 -> do
              vs <- (VU.map fromIntegral <$> decodePackedVarint)
              loop (msg { generatedCodeInfoAnnotationPath = (msg.generatedCodeInfoAnnotationPath <> vs)})
            _ -> do
              v <- (fromIntegral <$> decodeFieldVarint)
              loop (msg { generatedCodeInfoAnnotationPath = (VU.snoc msg.generatedCodeInfoAnnotationPath v)})
          2 -> do
            v <- decodeFieldString
            loop (msg { generatedCodeInfoAnnotationSourceFile = (Just v)})
          3 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { generatedCodeInfoAnnotationBegin = (Just v)})
          4 -> do
            v <- (fromIntegral <$> decodeFieldVarint)
            loop (msg { generatedCodeInfoAnnotationEnd = (Just v)})
          5 -> do
            v <- decodeFieldEnum
            loop (msg { generatedCodeInfoAnnotationSemantic = (Just v)})
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { generatedCodeInfoAnnotationUnknownFields = (uf : msg.generatedCodeInfoAnnotationUnknownFields)}))

-- | Field descriptors for 'GeneratedCodeInfo'Annotation', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
generatedCodeInfo'AnnotationFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor GeneratedCodeInfo'Annotation)
generatedCodeInfo'AnnotationFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "path"
        , fdNumber = 1
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelRepeated
        , fdGet = generatedCodeInfoAnnotationPath
        , fdSet = \v m -> m { generatedCodeInfoAnnotationPath = v }
        }), (2, SomeField FieldDescriptor
        { fdName = "source_file"
        , fdNumber = 2
        , fdTypeDesc = ScalarType StringField
        , fdLabel = LabelOptional
        , fdGet = generatedCodeInfoAnnotationSourceFile
        , fdSet = \v m -> m { generatedCodeInfoAnnotationSourceFile = v }
        })
    , (3, SomeField FieldDescriptor
        { fdName = "begin"
        , fdNumber = 3
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = generatedCodeInfoAnnotationBegin
        , fdSet = \v m -> m { generatedCodeInfoAnnotationBegin = v }
        })
    , (4, SomeField FieldDescriptor
        { fdName = "end"
        , fdNumber = 4
        , fdTypeDesc = ScalarType Int32Field
        , fdLabel = LabelOptional
        , fdGet = generatedCodeInfoAnnotationEnd
        , fdSet = \v m -> m { generatedCodeInfoAnnotationEnd = v }
        })
    , (5, SomeField FieldDescriptor
        { fdName = "semantic"
        , fdNumber = 5
        , fdTypeDesc = MessageType "Semantic"
        , fdLabel = LabelOptional
        , fdGet = generatedCodeInfoAnnotationSemantic
        , fdSet = \v m -> m { generatedCodeInfoAnnotationSemantic = v }
        })
    ]

instance ProtoMessage GeneratedCodeInfo'Annotation where
  protoMessageName _ = "google.protobuf.GeneratedCodeInfo.Annotation"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultGeneratedCodeInfo'Annotation
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = generatedCodeInfo'AnnotationFieldDescriptors

instance IsMessage GeneratedCodeInfo'Annotation

instance Aeson.ToJSON GeneratedCodeInfo'Annotation where
  toJSON msg = jsonObject
      [ "path" .=: msg.generatedCodeInfoAnnotationPath
      , "sourceFile" .=: msg.generatedCodeInfoAnnotationSourceFile
      , "begin" .=: msg.generatedCodeInfoAnnotationBegin
      , "end" .=: msg.generatedCodeInfoAnnotationEnd
      , "semantic" .=: msg.generatedCodeInfoAnnotationSemantic
      ]

instance Aeson.FromJSON GeneratedCodeInfo'Annotation where
  parseJSON = Aeson.withObject "GeneratedCodeInfo'Annotation" $ \obj -> do
    fld_generatedCodeInfoAnnotationPath <- parseFieldMaybe obj "path"
    fld_generatedCodeInfoAnnotationSourceFile <- parseFieldMaybe obj "sourceFile"
    fld_generatedCodeInfoAnnotationBegin <- parseFieldMaybe obj "begin"
    fld_generatedCodeInfoAnnotationEnd <- parseFieldMaybe obj "end"
    fld_generatedCodeInfoAnnotationSemantic <- parseFieldMaybe obj "semantic"
    pure defaultGeneratedCodeInfo'Annotation
      { generatedCodeInfoAnnotationPath = maybe (generatedCodeInfoAnnotationPath defaultGeneratedCodeInfo'Annotation) id fld_generatedCodeInfoAnnotationPath
      , generatedCodeInfoAnnotationSourceFile = maybe (generatedCodeInfoAnnotationSourceFile defaultGeneratedCodeInfo'Annotation) id fld_generatedCodeInfoAnnotationSourceFile
      , generatedCodeInfoAnnotationBegin = maybe (generatedCodeInfoAnnotationBegin defaultGeneratedCodeInfo'Annotation) id fld_generatedCodeInfoAnnotationBegin
      , generatedCodeInfoAnnotationEnd = maybe (generatedCodeInfoAnnotationEnd defaultGeneratedCodeInfo'Annotation) id fld_generatedCodeInfoAnnotationEnd
      , generatedCodeInfoAnnotationSemantic = maybe (generatedCodeInfoAnnotationSemantic defaultGeneratedCodeInfo'Annotation) id fld_generatedCodeInfoAnnotationSemantic
      }

instance Hashable GeneratedCodeInfo'Annotation where
  hashWithSalt salt msg = hashWithSalt (hashWithSalt (hashWithSalt (hashWithSalt (VU.foldl' hashWithSalt (salt) msg.generatedCodeInfoAnnotationPath) msg.generatedCodeInfoAnnotationSourceFile) msg.generatedCodeInfoAnnotationBegin) msg.generatedCodeInfoAnnotationEnd) msg.generatedCodeInfoAnnotationSemantic

instance Proto.Extension.HasExtensions GeneratedCodeInfo'Annotation where
  messageUnknownFields = generatedCodeInfoAnnotationUnknownFields
  setMessageUnknownFields !ufs msg = msg { generatedCodeInfoAnnotationUnknownFields = ufs }

instance Semigroup GeneratedCodeInfo'Annotation where
  a <> b = GeneratedCodeInfo'Annotation
    { generatedCodeInfoAnnotationPath = a.generatedCodeInfoAnnotationPath <> b.generatedCodeInfoAnnotationPath
    , generatedCodeInfoAnnotationSourceFile = case b.generatedCodeInfoAnnotationSourceFile of { Nothing -> a.generatedCodeInfoAnnotationSourceFile; x -> x }
    , generatedCodeInfoAnnotationBegin = case b.generatedCodeInfoAnnotationBegin of { Nothing -> a.generatedCodeInfoAnnotationBegin; x -> x }
    , generatedCodeInfoAnnotationEnd = case b.generatedCodeInfoAnnotationEnd of { Nothing -> a.generatedCodeInfoAnnotationEnd; x -> x }
    , generatedCodeInfoAnnotationSemantic = case b.generatedCodeInfoAnnotationSemantic of { Nothing -> a.generatedCodeInfoAnnotationSemantic; x -> x }
    , generatedCodeInfoAnnotationUnknownFields = a.generatedCodeInfoAnnotationUnknownFields <> b.generatedCodeInfoAnnotationUnknownFields
    }

instance Monoid GeneratedCodeInfo'Annotation where
  mempty = defaultGeneratedCodeInfo'Annotation

defaultGeneratedCodeInfo :: GeneratedCodeInfo
defaultGeneratedCodeInfo = GeneratedCodeInfo
  { generatedCodeInfoAnnotation = V.empty
  , generatedCodeInfoUnknownFields = []
  }

instance MessageEncode GeneratedCodeInfo where
  buildSized msg =
    V.foldl' (\acc v -> acc <> archSubmessage 10 (buildSized v)) mempty msg.generatedCodeInfoAnnotation
    <> encodeUnknownFieldsSized msg.generatedCodeInfoUnknownFields

instance MessageDecode GeneratedCodeInfo where
  {-# INLINE messageDecoder #-}
  messageDecoder = stage_0 defaultGeneratedCodeInfo emptyGrowList
    where
      stage_0 msg gl_0 =
        inOrderStage1
          (0xa :: Data.Word.Word8)
          decodeFieldMessage
          (\v -> stage_0 msg (snocGrowList gl_0 v))
          (pure (case msg.generatedCodeInfoUnknownFields of { [] -> msg { generatedCodeInfoAnnotation = growListToVector gl_0 }; _ -> msg { generatedCodeInfoAnnotation = growListToVector gl_0, generatedCodeInfoUnknownFields = reverse (msg.generatedCodeInfoUnknownFields) } }))
          (loop msg gl_0)
      loop msg gl_0 = withTagM
        (pure (case msg.generatedCodeInfoUnknownFields of { [] -> msg { generatedCodeInfoAnnotation = growListToVector gl_0 }; _ -> msg { generatedCodeInfoAnnotation = growListToVector gl_0, generatedCodeInfoUnknownFields = reverse (msg.generatedCodeInfoUnknownFields) } }))
        (\fn wt -> case fn of
          1 -> do
            v <- decodeFieldMessage
            loop msg (snocGrowList gl_0 v)
          _ -> do
            uf <- captureUnknownField fn (Prelude.toEnum wt)
            loop (msg { generatedCodeInfoUnknownFields = (uf : msg.generatedCodeInfoUnknownFields)}) gl_0)

-- | Field descriptors for 'GeneratedCodeInfo', keyed by proto field number.
--
-- Top-level CAF: allocated lazily on first force, shared on every
-- subsequent 'protoFieldDescriptors' call (no per-call rebuild).
generatedCodeInfoFieldDescriptors :: IntMap.IntMap (SomeFieldDescriptor GeneratedCodeInfo)
generatedCodeInfoFieldDescriptors =
  IntMap.fromList
    [ (1, SomeField FieldDescriptor
        { fdName = "annotation"
        , fdNumber = 1
        , fdTypeDesc = MessageType "Annotation"
        , fdLabel = LabelRepeated
        , fdGet = generatedCodeInfoAnnotation
        , fdSet = \v m -> m { generatedCodeInfoAnnotation = v }
        })
    ]

instance ProtoMessage GeneratedCodeInfo where
  protoMessageName _ = "google.protobuf.GeneratedCodeInfo"
  protoPackageName _ = "google.protobuf"
  protoDefaultValue = defaultGeneratedCodeInfo
  protoFileDescriptorBytes _ = fileDescriptorProtoBytes
  protoFieldDescriptors _ = generatedCodeInfoFieldDescriptors

instance IsMessage GeneratedCodeInfo

instance Aeson.ToJSON GeneratedCodeInfo where
  toJSON msg = jsonObject
      [ "annotation" .=: msg.generatedCodeInfoAnnotation

      ]

instance Aeson.FromJSON GeneratedCodeInfo where
  parseJSON = Aeson.withObject "GeneratedCodeInfo" $ \obj -> do
    fld_generatedCodeInfoAnnotation <- parseFieldMaybe obj "annotation"
    pure defaultGeneratedCodeInfo
      { generatedCodeInfoAnnotation = maybe (generatedCodeInfoAnnotation defaultGeneratedCodeInfo) id fld_generatedCodeInfoAnnotation
      }

instance Hashable GeneratedCodeInfo where
  hashWithSalt salt msg = V.foldl' hashWithSalt (salt) msg.generatedCodeInfoAnnotation

instance Proto.Extension.HasExtensions GeneratedCodeInfo where
  messageUnknownFields = generatedCodeInfoUnknownFields
  setMessageUnknownFields !ufs msg = msg { generatedCodeInfoUnknownFields = ufs }

instance Semigroup GeneratedCodeInfo where
  a <> b = GeneratedCodeInfo
    { generatedCodeInfoAnnotation = a.generatedCodeInfoAnnotation <> b.generatedCodeInfoAnnotation
    , generatedCodeInfoUnknownFields = a.generatedCodeInfoUnknownFields <> b.generatedCodeInfoUnknownFields
    }

instance Monoid GeneratedCodeInfo where
  mempty = defaultGeneratedCodeInfo