Document
========

.. _Document: 

Document
--------

Represents a document. Basically, a document is everything that is not a collection within the document root collection.

.. code-block:: json

 message Document {
  string id = 1;
  string dataroom_id = 2;
  string parent_id = 3;
  string name = 4;
  string type = 5;
  string author = 6;
  string title = 7;
  optional string path = 8;
  string version = 9;
  uint32 document_size = 10;
  google.protobuf.Timestamp creation_date = 11;
  google.protobuf.Timestamp modification_date = 12;
  string md5_checksum = 13;
  bool pdf_variant_exists = 14;
  EffectivePermission effective_permission = 15;
  string mime_type = 16;
  bool pdf_variant_creatable = 17;
  string thumbnail_id = 18;
  string description = 19;
  string document_class = 20;
  optional Statistics document_statistics = 21;
  repeated ItemPermissionsEntry permissions = 22;
  optional string restore_path = 23;
  optional Parents parents = 24;
  optional string parent_title = 25;
  optional string sequence = 26;
  optional string index = 27;
  optional bool no_index = 28;
  optional bool is_expired = 29;
  optional bool is_read = 30;
  optional google.protobuf.Timestamp read_date = 57;
  optional bool has_comments = 58;
  ItemType item_type = 31;
  optional ItemSubType item_subtype = 32;
  optional bool is_approved = 33;
  optional Labels labels = 34;
  optional bool has_different_parent_rights = 35;
  optional DocumentStatus status = 36;
  optional string status_set_by = 37;
  optional uint32 comments_count = 39;
  optional string version_owner = 40;
  optional Parent parent = 41;
  optional bool can_approve = 42;
  optional google.protobuf.Timestamp approved_on = 43;
  optional string approved_by = 44;
  optional uint32 number_of_shared_annotations = 45;
  optional bool has_redaction_annotations = 46;
  optional string sort_type = 50;
  optional bool is_symlink = 51;
  optional bool is_shared = 52;
  optional string document_state = 53;
  optional string document_state_set_by = 54;

  map<uint32, uint32> sum_children = 55;
  map<uint32, uint32> sum_decendents = 56;
  optional bool is_redacted = 67;
 }

.. list-table::
   :widths: 20 20 60
   :header-rows: 1

   * - Field
     - Type
     - Description
   * - ``id``
     - ``string``
     -
   * - ``dataroom_id``
     - ``string``
     -
   * - ``parent_id``
     - ``string``
     -
   * - ``name``
     - ``string``
     -
   * - ``type``
     - ``string``
     -
   * - ``author``
     - ``string``
     -
   * - ``title``
     - ``string``
     -
   * - ``path``
     - ``string``
     - optional 
   * - ``version``
     - ``string``
     -
   * - ``document_size``
     - ``uint32``
     -
   * - ``creation_date``
     - ``google.protobuf.Timestamp``
     -
   * - ``modification_date``
     - ``google.protobuf.Timestamp``
     -
   * - ``md5_checksum``
     - ``string``
     -
   * - ``pdf_variant_exists``
     - ``bool``
     -
   * - ``effective_permission``
     - ``EffectivePermission``
     -
   * - ``mime_type``
     - ``string``
     -
   * - ``pdf_variant_creatable``
     - ``bool``
     -
   * - ``thumbnail_id``
     - ``string``
     -
   * - ``description``
     - ``string``
     -
   * - ``document_class``
     - ``string``
     -
   * - ``document_statistics``
     - ``Statistics``
     - optional 
   * - ``permissions``
     - array of ``ItemPermissionsEntry``
     -
   * - ``restore_path``
     - ``string``
     - optional 
   * - ``parents``
     - ``Parents``
     - optional 
   * - ``parent_title``
     - ``string``
     - optional
   * - ``sequence``
     - ``string``
     - optional 
   * - ``index``
     - ``string``
     - optional 
   * - ``no_index``
     - ``bool``
     - optional 
   * - ``is_expired``
     - ``bool``
     - optional 
   * - ``is_read``
     - ``bool``
     - optional 
   * - ``read_date``
     - ``google.protobuf.Timestamp``
     - optional 
   * - ``has_comments``
     - ``bool``
     - optional 
   * - ``item_type``
     - ``ItemType``
     -
   * - ``item_subtype``
     - ``ItemSubType``
     - optional 
   * - ``is_approved``
     - ``bool``
     - optional 
   * - ``labels``
     - ``Labels``
     - optional 
   * - ``has_different_parent_rights``
     - ``bool``
     - optional 
   * - ``status``
     - ``DocumentStatus``
     - optional 
   * - ``status_set_by``
     - ``string``
     - optional
   * - ``comments_count``
     - ``uint32``
     - optional 
   * - ``version_owner``
     - ``string``
     - optional 
   * - ``parent``
     - ``Parent``
     - optional 
   * - ``can_approve``
     - ``bool``
     - optional 
   * - ``approved_on``
     - ``google.protobuf.Timestamp``
     - optional 
   * - ``approved_by``
     - ``string``
     - optional 
   * - ``number_of_shared_annotations``
     - ``uint32``
     - optional 
   * - ``has_redaction_annotations``
     - ``bool``
     - optional 
   * - ``sort_type``
     - ``string``
     - optional 
   * - ``is_symlink``
     - ``bool``
     - optional 
   * - ``is_shared``
     - ``bool``
     - optional
   * - ``document_state``
     - ``string``
     - optional 
   * - ``document_state_set_by``
     - ``string``
     - optional 
   * - ``sum_children``
     - ``map<uint32, uint32>``
     -
   * - ``sum_decendents``
     - ``map<uint32, uint32>``
     -
   * - ``is_redacted``
     - ``bool``
     - optional 


.. _Parent:

Parent
------

Defines one parent

.. code-block:: json

 message Parent {
  string id = 1;
  string name = 2;
  string title = 3;
  ItemType item_type = 4;
  optional string index = 5;
  optional bool is_symlink = 6;
 }

+-----------------+--------------+-------------+
| Field           | Type         | Description |
+=================+==============+=============+
| ``id``          | ``string``   |             |
+-----------------+--------------+-------------+
| ``name``        | ``string``   |             |
+-----------------+--------------+-------------+
| ``title``       | ``string``   |             |
+-----------------+--------------+-------------+
| ``item_type``   | ``ItemType`` |             |
+-----------------+--------------+-------------+
| ``index``       | ``string``   | *Optional*  |
+-----------------+--------------+-------------+
| ``is_symlink``` | ``bool``     | *Optional*  |
+-----------------+--------------+-------------+

.. _Parents:

Parents
-------

Defines array of parents

.. code-block:: json

message Parents {
  repeated Parent items = 1;
}

+------------+---------------------+-------------+
| Field      | Type                | Description |
+============+=====================+=============+
| ``items``` | array of ``Parent`` |             |
+------------+---------------------+-------------+

.. _Statistics:

Statistics
----------

Statistics for a document like access count or last access

.. code-block:: json 

 message Statistics {
  optional uint32 access_count = 1;
  optional google.protobuf.Timestamp last_access = 2;
 }

+------------------+-------------------------------+--------------+
| Field            | Type                          | Description  |
+==================+===============================+==============+
| ``access_count`` | ``uint32```                   | **Optional** |
+------------------+-------------------------------+--------------+
| ``last_access``  | ``google.protobuf.Timestamp`` | **Optional** |
+------------------+-------------------------------+--------------+

.. _SettingsEntryAsDocumentStatus:

SettingsEntryAsDocumentStatus
-----------------------------

Property for document status

.. code-block:: json

 message SettingsEntryAsDocumentStatus {
  DocumentStatus value = 1;
  bool editable = 2;
  optional string tooltip_type = 4;
 }

+------------------+--------------------+--------------+
| Field            | Type               | Description  |
+==================+====================+==============+
| ``value``        | ``DocumentStatus`` |              |
+------------------+--------------------+--------------+
| ``editable``     | ``bool``           |              |
+------------------+--------------------+--------------+
| ``tooltip_type`` | ``string``         | **Optional** |
+------------------+--------------------+--------------+

.. _SettingsEntryAsStatistics:

SettingsEntryAsStatistics
-------------------------

Property for document statistics

.. code-block:: json

 message SettingsEntryAsStatistics {
  Statistics value = 1;
  bool editable = 2;
  optional string tooltip_type = 4;
 }

+------------------+----------------+--------------+
| Field            | Type           | Description  |
+==================+================+==============+
| ``value``        | ``Statistics`` |              |
+------------------+----------------+--------------+
| ``editable``     | ``bool``       |              |
+------------------+----------------+--------------+
| ``tooltip_type`` | ``string``     | **Optional** |
+------------------+----------------+--------------+

.. _SettingsEntryAsDocumentState:

SettingsEntryAsDocumentState
----------------------------

Property for setting document state

.. code-block:: json

 message SettingsEntryAsDocumentState {
  string value = 1;
  bool editable = 2;
  optional string tooltip_type = 4;
  repeated string allowed_list = 5;
 }

+------------------+---------------------+--------------+
| Field            | Type                | Description  |
+==================+=====================+==============+
| ``value``        | ``string``          |              |
+------------------+---------------------+--------------+
| ``editable``     | ``bool``            |              |
+------------------+---------------------+--------------+
| ``tooltip_type`` | ``string``          | **Optional** |
+------------------+---------------------+--------------+
| ``allowed_list`` | array of ``string`` |              |
+------------------+---------------------+--------------+

.. _DocumentProperties:

DocumentProperties
------------------

Properties of a single document

.. code-block:: json

 message DocumentProperties {
  string id = 1;
  optional SettingsEntryAsString name = 4;
  optional SettingsEntryAsString author = 6;
  optional SettingsEntryAsString title = 7;
  optional SettingsEntryAsString sequence = 8;
  optional SettingsEntryAsString index = 9;
  optional SettingsEntryAsBool no_index = 20;
  optional SettingsEntryAsString path = 10;
  optional SettingsEntryAsString version = 11;
  optional SettingsEntryAsString version_owner = 12;
  optional SettingsEntryAsNumber document_size = 13;
  optional SettingsEntryAsDate creation_date = 14;
  optional SettingsEntryAsDate modification_date = 15;
  optional SettingsEntryAsString description = 19;
  optional SettingsEntryAsStatistics document_statistics = 21;
  optional SettingsEntryAsString tags = 22;
  optional SettingsEntryAsString url = 23;
  optional SettingsEntryAsBool is_read = 24;
  optional SettingsEntryAsDocumentStatus status = 25;
  optional SettingsEntryAsString status_set_by = 26;
  optional SettingsEntryAsString approval_group = 27;
  optional SettingsEntryAsDate approved_on = 28;
  optional SettingsEntryAsString approved_by = 29;
  optional SettingsEntryAsBool is_approved = 30;
  optional SettingsEntryAsDate expiration_date = 31;
  optional SettingsEntryAsDate deleted_on = 38;
  optional SettingsEntryAsBool has_different_parent_rights = 35;
  ItemType item_type = 32;
  optional ItemSubType item_subtype = 33;
  optional Parent parent = 34;
  optional SettingsEntryAsDocumentState document_state = 40;
  optional SettingsEntryAsBool is_redacted = 41;
 }

.. list-table::
   :widths: 20 20 60
   :header-rows: 1

   * - Field
     - Type
     - Description
   * - ``id``
     - ``string``
     -
   * - ``name``
     - ``SettingsEntryAsString``
     - optional 
   * - ``author``
     - ``SettingsEntryAsString``
     - optional 
   * - ``title``
     - ``SettingsEntryAsString``
     - optional 
   * - ``sequence``
     - ``SettingsEntryAsString``
     - optional 
   * - ``index``
     - ``SettingsEntryAsString``
     - optional 
   * - ``no_index``
     - ``SettingsEntryAsBool``
     - optional 
   * - ``path``
     - ``SettingsEntryAsString``
     - optional 
   * - ``version``
     - ``SettingsEntryAsString``
     - optional 
   * - ``version_owner``
     - ``SettingsEntryAsString``
     - optional 
   * - ``document_size``
     - ``SettingsEntryAsNumber``
     - optional 
   * - ``creation_date``
     - ``SettingsEntryAsDate``
     - optional 
   * - ``modification_date``
     - ``SettingsEntryAsDate``
     - optional 
   * - ``description``
     - ``SettingsEntryAsString``
     - optional 
   * - ``document_statistics``
     - ``SettingsEntryAsStatistics``
     - optional 
   * - ``tags``
     - ``SettingsEntryAsString``
     - optional 
   * - ``url``
     - ``SettingsEntryAsString``
     - optional 
   * - ``is_read``
     - ``SettingsEntryAsBool``
     - optional 
   * - ``status``
     - ``SettingsEntryAsDocumentStatus``
     - optional 
   * - ``status_set_by``
     - ``SettingsEntryAsString``
     - optional 
   * - ``approval_group``
     - ``SettingsEntryAsString``
     - optional 
   * - ``approved_on``
     - ``SettingsEntryAsDate``
     - optional 
   * - ``approved_by``
     - ``SettingsEntryAsString``
     - optional 
   * - ``is_approved``
     - ``SettingsEntryAsBool``
     - optional 
   * - ``expiration_date``
     - ``SettingsEntryAsDate``
     - optional 
   * - ``deleted_on``
     - ``SettingsEntryAsDate``
     - optional 
   * - ``has_different_parent_rights``
     - ``SettingsEntryAsBool``
     - optional 
   * - ``item_type``
     - ``ItemType``
     -
   * - ``item_subtype``
     - ``ItemSubType``
     - optional 
   * - ``parent``
     - ``Parent``
     - optional 
   * - ``document_state``
     - ``SettingsEntryAsDocumentState``
     - optional 
   * - ``is_redacted``
     - ``SettingsEntryAsBool``
     - optional 

