/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
/* Generated from: common/collection.proto */

#ifndef PROTOBUF_C_common_2fcollection_2eproto__INCLUDED
#define PROTOBUF_C_common_2fcollection_2eproto__INCLUDED

#include <protobuf-c/protobuf-c.h>

PROTOBUF_C__BEGIN_DECLS

#if PROTOBUF_C_VERSION_NUMBER < 1000000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif

#include "common/policies.pb-c.h"

typedef struct _Common__CollectionConfigPackage Common__CollectionConfigPackage;
typedef struct _Common__CollectionConfig Common__CollectionConfig;
typedef struct _Common__StaticCollectionConfig Common__StaticCollectionConfig;
typedef struct _Common__CollectionPolicyConfig Common__CollectionPolicyConfig;
typedef struct _Common__CollectionCriteria Common__CollectionCriteria;


/* --- enums --- */


/* --- messages --- */

/*
 * CollectionConfigPackage represents an array of CollectionConfig
 * messages; the extra struct is required because repeated oneof is
 * forbidden by the protobuf syntax
 */
struct  _Common__CollectionConfigPackage
{
  ProtobufCMessage base;
  size_t n_config;
  Common__CollectionConfig **config;
};
#define COMMON__COLLECTION_CONFIG_PACKAGE__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&common__collection_config_package__descriptor) \
    , 0,NULL }


typedef enum {
  COMMON__COLLECTION_CONFIG__PAYLOAD__NOT_SET = 0,
  COMMON__COLLECTION_CONFIG__PAYLOAD_STATIC_COLLECTION_CONFIG = 1,
} Common__CollectionConfig__PayloadCase;

/*
 * CollectionConfig defines the configuration of a collection object;
 * it currently contains a single, static type.
 * Dynamic collections are deferred.
 */
struct  _Common__CollectionConfig
{
  ProtobufCMessage base;
  Common__CollectionConfig__PayloadCase payload_case;
  union {
    Common__StaticCollectionConfig *static_collection_config;
  };
};
#define COMMON__COLLECTION_CONFIG__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&common__collection_config__descriptor) \
    , COMMON__COLLECTION_CONFIG__PAYLOAD__NOT_SET, {0} }


/*
 * StaticCollectionConfig constitutes the configuration parameters of a
 * static collection object. Static collections are collections that are
 * known at chaincode instantiation time, and that cannot be changed.
 * Dynamic collections are deferred.
 */
struct  _Common__StaticCollectionConfig
{
  ProtobufCMessage base;
  /*
   * the name of the collection inside the denoted chaincode
   */
  char *name;
  /*
   * a reference to a policy residing / managed in the config block
   * to define which orgs have access to this collection’s private data
   */
  Common__CollectionPolicyConfig *member_orgs_policy;
  /*
   * The minimum number of peers private data will be sent to upon
   * endorsement. The endorsement would fail if dissemination to at least
   * this number of peers is not achieved.
   */
  protobuf_c_boolean has_required_peer_count;
  int32_t required_peer_count;
  /*
   * The maximum number of peers that private data will be sent to
   * upon endorsement. This number has to be bigger than required_peer_count.
   */
  protobuf_c_boolean has_maximum_peer_count;
  int32_t maximum_peer_count;
  /*
   * The number of blocks after which the collection data expires.
   * For instance if the value is set to 10, a key last modified by block number 100
   * will be purged at block number 111. A zero value is treated same as MaxUint64
   */
  protobuf_c_boolean has_block_to_live;
  uint64_t block_to_live;
  /*
   * The member only read access denotes whether only collection member clients
   * can read the private data (if set to true), or even non members can 
   * read the data (if set to false, for example if you want to implement more granular
   * access logic in the chaincode)
   */
  protobuf_c_boolean has_member_only_read;
  protobuf_c_boolean member_only_read;
};
#define COMMON__STATIC_COLLECTION_CONFIG__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&common__static_collection_config__descriptor) \
    , NULL, NULL, 0,0, 0,0, 0,0, 0,0 }


typedef enum {
  COMMON__COLLECTION_POLICY_CONFIG__PAYLOAD__NOT_SET = 0,
  COMMON__COLLECTION_POLICY_CONFIG__PAYLOAD_SIGNATURE_POLICY = 1,
} Common__CollectionPolicyConfig__PayloadCase;

/*
 * Collection policy configuration. Initially, the configuration can only
 * contain a SignaturePolicy. In the future, the SignaturePolicy may be a
 * more general Policy. Instead of containing the actual policy, the
 * configuration may in the future contain a string reference to a policy.
 */
struct  _Common__CollectionPolicyConfig
{
  ProtobufCMessage base;
  Common__CollectionPolicyConfig__PayloadCase payload_case;
  union {
    /*
     * Initially, only a signature policy is supported.
     */
    /*
     * Later, the SignaturePolicy will be replaced by a Policy.
     *        Policy policy = 1;
     * A reference to a Policy is planned to be added later.
     *        string reference = 2;
     */
    Common__SignaturePolicyEnvelope *signature_policy;
  };
};
#define COMMON__COLLECTION_POLICY_CONFIG__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&common__collection_policy_config__descriptor) \
    , COMMON__COLLECTION_POLICY_CONFIG__PAYLOAD__NOT_SET, {0} }


/*
 * CollectionCriteria defines an element of a private data that corresponds
 * to a certain transaction and collection
 */
struct  _Common__CollectionCriteria
{
  ProtobufCMessage base;
  char *channel;
  char *tx_id;
  char *collection;
  char *namespace_;
};
#define COMMON__COLLECTION_CRITERIA__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&common__collection_criteria__descriptor) \
    , NULL, NULL, NULL, NULL }


/* Common__CollectionConfigPackage methods */
void   common__collection_config_package__init
                     (Common__CollectionConfigPackage         *message);
size_t common__collection_config_package__get_packed_size
                     (const Common__CollectionConfigPackage   *message);
size_t common__collection_config_package__pack
                     (const Common__CollectionConfigPackage   *message,
                      uint8_t             *out);
size_t common__collection_config_package__pack_to_buffer
                     (const Common__CollectionConfigPackage   *message,
                      ProtobufCBuffer     *buffer);
Common__CollectionConfigPackage *
       common__collection_config_package__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   common__collection_config_package__free_unpacked
                     (Common__CollectionConfigPackage *message,
                      ProtobufCAllocator *allocator);
/* Common__CollectionConfig methods */
void   common__collection_config__init
                     (Common__CollectionConfig         *message);
size_t common__collection_config__get_packed_size
                     (const Common__CollectionConfig   *message);
size_t common__collection_config__pack
                     (const Common__CollectionConfig   *message,
                      uint8_t             *out);
size_t common__collection_config__pack_to_buffer
                     (const Common__CollectionConfig   *message,
                      ProtobufCBuffer     *buffer);
Common__CollectionConfig *
       common__collection_config__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   common__collection_config__free_unpacked
                     (Common__CollectionConfig *message,
                      ProtobufCAllocator *allocator);
/* Common__StaticCollectionConfig methods */
void   common__static_collection_config__init
                     (Common__StaticCollectionConfig         *message);
size_t common__static_collection_config__get_packed_size
                     (const Common__StaticCollectionConfig   *message);
size_t common__static_collection_config__pack
                     (const Common__StaticCollectionConfig   *message,
                      uint8_t             *out);
size_t common__static_collection_config__pack_to_buffer
                     (const Common__StaticCollectionConfig   *message,
                      ProtobufCBuffer     *buffer);
Common__StaticCollectionConfig *
       common__static_collection_config__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   common__static_collection_config__free_unpacked
                     (Common__StaticCollectionConfig *message,
                      ProtobufCAllocator *allocator);
/* Common__CollectionPolicyConfig methods */
void   common__collection_policy_config__init
                     (Common__CollectionPolicyConfig         *message);
size_t common__collection_policy_config__get_packed_size
                     (const Common__CollectionPolicyConfig   *message);
size_t common__collection_policy_config__pack
                     (const Common__CollectionPolicyConfig   *message,
                      uint8_t             *out);
size_t common__collection_policy_config__pack_to_buffer
                     (const Common__CollectionPolicyConfig   *message,
                      ProtobufCBuffer     *buffer);
Common__CollectionPolicyConfig *
       common__collection_policy_config__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   common__collection_policy_config__free_unpacked
                     (Common__CollectionPolicyConfig *message,
                      ProtobufCAllocator *allocator);
/* Common__CollectionCriteria methods */
void   common__collection_criteria__init
                     (Common__CollectionCriteria         *message);
size_t common__collection_criteria__get_packed_size
                     (const Common__CollectionCriteria   *message);
size_t common__collection_criteria__pack
                     (const Common__CollectionCriteria   *message,
                      uint8_t             *out);
size_t common__collection_criteria__pack_to_buffer
                     (const Common__CollectionCriteria   *message,
                      ProtobufCBuffer     *buffer);
Common__CollectionCriteria *
       common__collection_criteria__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   common__collection_criteria__free_unpacked
                     (Common__CollectionCriteria *message,
                      ProtobufCAllocator *allocator);
/* --- per-message closures --- */

typedef void (*Common__CollectionConfigPackage_Closure)
                 (const Common__CollectionConfigPackage *message,
                  void *closure_data);
typedef void (*Common__CollectionConfig_Closure)
                 (const Common__CollectionConfig *message,
                  void *closure_data);
typedef void (*Common__StaticCollectionConfig_Closure)
                 (const Common__StaticCollectionConfig *message,
                  void *closure_data);
typedef void (*Common__CollectionPolicyConfig_Closure)
                 (const Common__CollectionPolicyConfig *message,
                  void *closure_data);
typedef void (*Common__CollectionCriteria_Closure)
                 (const Common__CollectionCriteria *message,
                  void *closure_data);

/* --- services --- */


/* --- descriptors --- */

extern const ProtobufCMessageDescriptor common__collection_config_package__descriptor;
extern const ProtobufCMessageDescriptor common__collection_config__descriptor;
extern const ProtobufCMessageDescriptor common__static_collection_config__descriptor;
extern const ProtobufCMessageDescriptor common__collection_policy_config__descriptor;
extern const ProtobufCMessageDescriptor common__collection_criteria__descriptor;

PROTOBUF_C__END_DECLS


#endif  /* PROTOBUF_C_common_2fcollection_2eproto__INCLUDED */
