// Generated by the protocol buffer compiler.  DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// clang-format off
// source: google/protobuf/any.proto

#import "GPBDescriptor.h"
#import "GPBMessage.h"
#import "GPBRootObject.h"

#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif

// @@protoc_insertion_point(imports)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

CF_EXTERN_C_BEGIN

NS_ASSUME_NONNULL_BEGIN

#pragma mark - GPBAnyRoot

/**
 * Exposes the extension registry for this file.
 *
 * The base class provides:
 * @code
 *   + (GPBExtensionRegistry *)extensionRegistry;
 * @endcode
 * which is a @c GPBExtensionRegistry that includes all the extensions defined by
 * this file and all files that it depends on.
 **/
GPB_FINAL @interface GPBAnyRoot : GPBRootObject
@end

#pragma mark - GPBAny

typedef GPB_ENUM(GPBAny_FieldNumber) {
  GPBAny_FieldNumber_TypeURL = 1,
  GPBAny_FieldNumber_Value = 2,
};

/**
 * `Any` contains an arbitrary serialized protocol buffer message along with a
 * URL that describes the type of the serialized message.
 *
 * Protobuf library provides support to pack/unpack Any values in the form
 * of utility functions or additional generated methods of the Any type.
 *
 * Example 1: Pack and unpack a message in C++.
 *
 *     Foo foo = ...;
 *     Any any;
 *     any.PackFrom(foo);
 *     ...
 *     if (any.UnpackTo(&foo)) {
 *       ...
 *     }
 *
 * Example 2: Pack and unpack a message in Java.
 *
 *     Foo foo = ...;
 *     Any any = Any.pack(foo);
 *     ...
 *     if (any.is(Foo.class)) {
 *       foo = any.unpack(Foo.class);
 *     }
 *     // or ...
 *     if (any.isSameTypeAs(Foo.getDefaultInstance())) {
 *       foo = any.unpack(Foo.getDefaultInstance());
 *     }
 *
 *  Example 3: Pack and unpack a message in Python.
 *
 *     foo = Foo(...)
 *     any = Any()
 *     any.Pack(foo)
 *     ...
 *     if any.Is(Foo.DESCRIPTOR):
 *       any.Unpack(foo)
 *       ...
 *
 *  Example 4: Pack and unpack a message in Go
 *
 *      foo := &pb.Foo{...}
 *      any, err := anypb.New(foo)
 *      if err != nil {
 *        ...
 *      }
 *      ...
 *      foo := &pb.Foo{}
 *      if err := any.UnmarshalTo(foo); err != nil {
 *        ...
 *      }
 *
 * The pack methods provided by protobuf library will by default use
 * 'type.googleapis.com/full.type.name' as the type URL and the unpack
 * methods only use the fully qualified type name after the last '/'
 * in the type URL, for example "foo.bar.com/x/y.z" will yield type
 * name "y.z".
 *
 * JSON
 * ====
 * The JSON representation of an `Any` value uses the regular
 * representation of the deserialized, embedded message, with an
 * additional field `\@type` which contains the type URL. Example:
 *
 *     package google.profile;
 *     message Person {
 *       string first_name = 1;
 *       string last_name = 2;
 *     }
 *
 *     {
 *       "\@type": "type.googleapis.com/google.profile.Person",
 *       "firstName": <string>,
 *       "lastName": <string>
 *     }
 *
 * If the embedded message type is well-known and has a custom JSON
 * representation, that representation will be embedded adding a field
 * `value` which holds the custom JSON in addition to the `\@type`
 * field. Example (for message [google.protobuf.Duration][]):
 *
 *     {
 *       "\@type": "type.googleapis.com/google.protobuf.Duration",
 *       "value": "1.212s"
 *     }
 **/
GPB_FINAL @interface GPBAny : GPBMessage

/**
 * A URL/resource name that uniquely identifies the type of the serialized
 * protocol buffer message. This string must contain at least
 * one "/" character. The last segment of the URL's path must represent
 * the fully qualified name of the type (as in
 * `path/google.protobuf.Duration`). The name should be in a canonical form
 * (e.g., leading "." is not accepted).
 *
 * In practice, teams usually precompile into the binary all types that they
 * expect it to use in the context of Any. However, for URLs which use the
 * scheme `http`, `https`, or no scheme, one can optionally set up a type
 * server that maps type URLs to message definitions as follows:
 *
 * * If no scheme is provided, `https` is assumed.
 * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
 *   value in binary format, or produce an error.
 * * Applications are allowed to cache lookup results based on the
 *   URL, or have them precompiled into a binary to avoid any
 *   lookup. Therefore, binary compatibility needs to be preserved
 *   on changes to types. (Use versioned type names to manage
 *   breaking changes.)
 *
 * Note: this functionality is not currently available in the official
 * protobuf release, and it is not used for type URLs beginning with
 * type.googleapis.com. As of May 2023, there are no widely used type server
 * implementations and no plans to implement one.
 *
 * Schemes other than `http`, `https` (or the empty scheme) might be
 * used with implementation specific semantics.
 **/
@property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL;

/** Must be a valid serialized protocol buffer of the above specified type. */
@property(nonatomic, readwrite, copy, null_resettable) NSData *value;

// NOTE: There are some Objective-C specific methods/properties in
// GPBWellKnownTypes.h that will likely be useful.

@end

NS_ASSUME_NONNULL_END

CF_EXTERN_C_END

#pragma clang diagnostic pop

// @@protoc_insertion_point(global_scope)

// clang-format on
