/*
Proto contract of Printer Gateway API module
This is a collection that allows for:
- Managing printer connectors

Version     Date            Author      Comment
V1.0.0      12-12-2024      KDJ        Initial version
V1.0.1      14-01-2025      KdJ         Updated proto references
V1.1.0      23-06-2025      SGi         Proto refactor for CRUD operations
*/

syntax = "proto3";

import "Interfaces/google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "Interfaces/PrintManager/Protos/V1/bergstein.digi.printmanager.paging.proto";
import "Interfaces/PrintManager/Protos/V1/bergstein.digi.printmanager.audit.proto";
import "Interfaces/PrintManager/Protos/V1/bergstein.digi.printmanager.proto_options.proto";
import "Interfaces/Application/Protos/V1/bergstein.digi.moduleinfo.proto";
import "Interfaces/Printer/Protos/V1/bergstein.digi.printer.proto";

package printergateway;

option csharp_namespace = "Bergstein.Digi.Shared.Interfaces.PrintManager.PrinterGateway.Protos.V1";

// Service for creating, reading, updating, deleting printer connections.
service PrinterConnectionService {
    
  /*
  Endpoint for creating printer connections in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - the created printer connection

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INVALID_ARGUMENT status when the one or more Printer Connection fields no not fall within the set format/limits.
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc CreatePrinterConnection (CreatePrinterConnectionRequest) returns (CreatePrinterConnectionReply) {
    option (google.api.http) = {
      post: "/printergateway_module/v1/printer_connection"
      body: "*"
    };
  }

  /*
  Endpoint for a getting a single printer connection in the system.

  This is only accessible for Administrator accounts or the requesting user.

  Returns on a success:
  - the requested printer connection

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - NOT_FOUND (5) status when the requested printer connection (ID), to fetch, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetPrinterConnection (GetPrinterConnectionRequest) returns (GetPrinterConnectionReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_connection/{id}"
    };
  }

  /*
  Endpoint for getting all the printer connections in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - list of registered printer connections

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListPrinterConnection (ListPrinterConnectionRequest) returns (ListPrinterConnectionReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_connection"
    };
  }

  /*
  Endpoint for updating a registered printer connection in the system.

  This is only accessible for Administrator accounts or the requesting user.

  Returns on a success:
  - the updated printer connection

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INVALID_ARGUMENT status when the one or more Printer Connection fields no not fall within the set format/limits.
  - NOT_FOUND (5) status when the requested printer connection (ID), to update, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc UpdatePrinterConnection (UpdatePrinterConnectionRequest) returns (UpdatePrinterConnectionReply) {
    option (google.api.http) = {
      patch: "/printergateway_module/v1/printer_connection"
      body: "*"
    };
  }

  /*
  Endpoint for deleting a registered printer connection in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - nothing; OK status (0)

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - NOT_FOUND (5) when the requested printer connection (ID), to remove, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc DeletePrinterConnection (DeletePrinterConnectionRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/printergateway_module/v1/printer_connection/{id}"
    };
  }

  /*
  Endpoint for subscribing on an event when an printer connection is updated.

  This endpoint provides a real-time stream of printer connections that have been modified in the system.
  Clients can optionally filter which printer connections they want to receive updates for.

  Returns on a success:
    - a stream of PrinterConnectionUpdated messages containing the modified printer connection; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectionUpdated (SubscribeOnPrinterConnectionUpdated) returns (stream PrinterConnectionUpdated) {

  }

  /*
  Endpoint for subscribing on an event when a new printer connection is created.

  This endpoint provides a real-time stream of newly created printer connections in the system.
  Clients can optionally filter which printer connections they want to receive creation notifications for.

  Returns on a success:
    - a stream of PrinterConnectionCreated messages containing the newly created printer connection; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectionCreated (SubscribeOnPrinterConnectionCreated) returns (stream PrinterConnectionCreated) {

  }

  /*
  Endpoint for subscribing on an event when an printer connection is deleted.

  This endpoint provides a real-time stream notification when printer connections are removed from the system.
  Clients can optionally filter which printer connections they want to receive deletion notifications for.

  Returns on a success:
    - a stream of PrinterConnectionDeleted messages containing the deleted printer connection information; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectionDeleted (SubscribeOnPrinterConnectionDeleted) returns (stream PrinterConnectionDeleted) {

  }
}

// The create printer connection request. The Id field should be left at 0, since this is created by the database.
message CreatePrinterConnectionRequest {
  // The new printerconnector
  PrinterConnection printer_connection = 1;
}

// The get printer connection request.
message GetPrinterConnectionRequest {
  // The matching Id of the printer connection to get.
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
}

// A request for Printer Connections.
message ListPrinterConnectionRequest {
  shared.PagingRequest paging = 1;
  bool descending = 2;
  PrinterConnection order = 3;
  PrinterConnection filter = 4;
}

// The update printer connection request.
message UpdatePrinterConnectionRequest {
  // The printer connection entity to update. Matches on the Id field.
  PrinterConnection printer_connection = 1;
}

// The delete printer connection request
message DeletePrinterConnectionRequest {
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
}

// The printer connection Reply.
message GetPrinterConnectionReply {
  // The printerconnector entity.
  PrinterConnection printer_connection = 1;
}

// The printer connection Reply.
message CreatePrinterConnectionReply {
  // The printerconnector entity.
  PrinterConnection printer_connection = 1;
}

// The printer connection Reply.
message UpdatePrinterConnectionReply {
  // The printerconnector entity.
  PrinterConnection printer_connection = 1;
}

// The printer connections Reply.
message ListPrinterConnectionReply {
  // The collection of printerconnectors.
  repeated PrinterConnection printer_connections = 1;
  shared.PagingReply paging = 2;
}

// A Printer Connection entity.
message PrinterConnection {
  // The id of the printer connection. This is generated by the database.
  string id = 1 [
      (proto_options.field_attributes) = IS_GUID,
      (proto_options.field_attributes) = IS_PRIMARY_KEY
  ];
  // The printer connector id that is attached to this connection. Each connector can only be used once
  google.protobuf.StringValue connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector that is attached to this connection. Each connector can only be used once
  PrinterConnector connector = 3;
  // Name of the Printer Connection. The minimum length is 3 characters and maximum length is 100 characters. Must be unique in the system.
  string name = 4;
  // Additional comments. Can be empty. If filled, maximum length is 250 characters.
  string comment = 5;
  // The audit information about this entity.
  shared.Audit audit = 6;
}

// The subscribe request 
message SubscribeOnPrinterConnectionUpdated {
  repeated string filter_printer_connection_ids = 1;
}

message PrinterConnectionUpdated {
  PrinterConnection printer_connection = 1;
}

message SubscribeOnPrinterConnectionCreated {
  repeated string filter_printer_connection_ids = 1;
}

message PrinterConnectionCreated{
  PrinterConnection printer_connection = 1;
}

message SubscribeOnPrinterConnectionDeleted {
  repeated string filter_printer_connection_ids = 1;
}

message PrinterConnectionDeleted{
  PrinterConnection printer_connection = 1;
}

// Service for reading info about the module configurations
service PrinterGatewayModuleInfoService {

  /*
  Endpoint for getting info about the this module.

  Returns on a success:
  - Info about this module

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  */
  rpc GetModuleInfo (google.protobuf.Empty) returns (module_info.ModuleInfoReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/module_info"
    };
  }

  /*
  Endpoint for getting the Feature Flag values of this module.

  Returns on a success:
  - list with the Feature Flags and their values.

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  */
  rpc GetFeatureFlags (google.protobuf.Empty) returns (module_info.FeatureFlagsReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/feature_flags"
    };
  }

  /*
  Endpoint for getting the Release Notes of this module.

  Returns on a success:
  - the release notes

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  */
  rpc GetReleaseNotes (google.protobuf.Empty) returns (module_info.ReleaseNotesReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/release_notes"
    };
  }  

  /*
  Endpoint for getting the Health Checks for this module.

  Returns on a success:
  - a list with healthchecks and their respective status.

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  */
  rpc GetHealthChecks (google.protobuf.Empty) returns (module_info.HealthChecksReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/health_checks"
    };
  }
}

// Service for creating, reading, updating, deleting printerconnectors.
service PrinterConnectorService {
    
  /*
  Endpoint for creating printer connectors in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - the created printer connector

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INVALID_ARGUMENT status when the one or more Printer Connector fields no not fall within the set format/limits.
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc CreatePrinterConnector (CreatePrinterConnectorRequest) returns (CreatePrinterConnectorReply) {
    option (google.api.http) = {
      post: "/printergateway_module/v1/printer_connector"
    };
  }

  /*
  Endpoint for a getting a single printer connector in the system.

  This is only accessible for Administrator accounts or the requesting user.

  Returns on a success:
  - the requested printer connector

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - NOT_FOUND (5) status when the requested printer connector (ID), to fetch, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetPrinterConnector (GetPrinterConnectorRequest) returns (GetPrinterConnectorReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_connector/{id}"
    };
  }

  /*
  Endpoint for getting all the printer connector in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - list of registered printer connectors

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListPrinterConnector (ListPrinterConnectorRequest) returns (ListPrinterConnectorReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_connector"
    };
  }

  /*
  Endpoint for updating a registered printer connector in the system.

  This is only accessible for Administrator accounts or the requesting user.

  Returns on a success:
  - the updated printer connector

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - INVALID_ARGUMENT status when the one or more Printer Connector fields no not fall within the set format/limits.
  - NOT_FOUND (5) status when the requested printer connector (ID), to update, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc UpdatePrinterConnector (UpdatePrinterConnectorRequest) returns (UpdatePrinterConnectorReply) {
    option (google.api.http) = {
      patch: "/printergateway_module/v1/printer_connector"
      body: "*"
    };
  }

  /*
  Endpoint for deleting a registered printer connector in the system.

  This is only accessible for Administrator accounts.

  Returns on a success:
  - nothing; OK status (0)

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - NOT_FOUND (5) when the requested printerconnector (ID), to remove, was not found
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc DeletePrinterConnector (DeletePrinterConnectorRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/printergateway_module/v1/printer_connector/{id}"
    };
  }

  /*
  Endpoint for subscribing on an event when an printer connector is updated.

  This endpoint provides a real-time stream of printer connectors that have been modified in the system.
  Clients can optionally filter which printer connectors they want to receive updates for.

  Returns on a success:
    - a stream of PrinterConnectorUpdated messages containing the modified printer connector; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectorUpdated (SubscribeOnPrinterConnectorUpdated) returns (stream PrinterConnectorUpdated) {

  }

  /*
  Endpoint for subscribing on an event when a new printer connector is created.

  This endpoint provides a real-time stream of newly created printer connectors in the system.
  Clients can optionally filter which printer connectors they want to receive creation notifications for.

  Returns on a success:
    - a stream of PrinterConnectorCreated messages containing the newly created printer connector; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectorCreated (SubscribeOnPrinterConnectorCreated) returns (stream PrinterConnectorCreated) {

  }

  /*
  Endpoint for subscribing on an event when an printer connector is deleted.

  This endpoint provides a real-time stream notification when printer connectors are removed from the system.
  Clients can optionally filter which printer connectors they want to receive deletion notifications for.

  Returns on a success:
    - a stream of PrinterConnectorDeleted messages containing the deleted printer connector information; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterConnectorDeleted (SubscribeOnPrinterConnectorDeleted) returns (stream PrinterConnectorDeleted) {

  }
}

// The create printerconnector request. The Id field should be left at 0, since this is created by the database.
message CreatePrinterConnectorRequest {
  // The new printerconnector
  PrinterConnector printer_connector = 1;
}

// The get printerconnector request.
message GetPrinterConnectorRequest {
  // The matching Id of the printerconnector to get.
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
}

// A request for PrinterConnectors.
message ListPrinterConnectorRequest {
  shared.PagingRequest paging = 1;
  bool descending = 2;
  PrinterConnector order = 3;
  PrinterConnector filter = 4;
}

// The update printerconnector request.
message UpdatePrinterConnectorRequest {
  // The printerconnector entity to update. Matches on the Id field.
  PrinterConnector printer_connector = 1;
}

message DeletePrinterConnectorRequest {
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
}

// The printerconnector Reply.
message GetPrinterConnectorReply {
  // The printerconnector entity.
  PrinterConnector printer_connector = 1;
}

// The printerconnector Reply.
message CreatePrinterConnectorReply {
  // The printerconnector entity.
  PrinterConnector printer_connector = 1;
}

// The printerconnector Reply.
message UpdatePrinterConnectorReply {
  // The printerconnector entity.
  PrinterConnector printer_connector = 1;
}

// The printerconnectors Reply.
message ListPrinterConnectorReply {
  // The collection of printerconnectors.
  repeated PrinterConnector printer_connectors = 1;
  shared.PagingReply paging = 2;
}

// A PrinterConnector entity.
message PrinterConnector {
  // The id of the printer connector.
  string id = 1 [
      (proto_options.field_attributes) = IS_GUID,
      (proto_options.field_attributes) = IS_PRIMARY_KEY
  ];
  // The name of the printer. The minimum length is 3 characters and maximum length is 100 characters. Must be unique in the system.
  string printer_name = 2;
  // The address of the printer. Must be in IPV4 (14 character) or IPV6 (39 characters) or FQDN format (max 250 characters)
  string address = 3;
  // The scheme of the printer connector. Needs to be http or https
  string scheme = 4;
  // The Port of the printer.
  int32 port = 5;
  // The flag indicating the printer type
  PrinterType printer_type = 6;
  // The physical location of the Printer
  string physical_location = 7;
  // Indicates whether the printer is enabled or not
  bool is_enabled = 8;
  // Indicates whether the printer is online or not
  bool is_online = 9;
  // Status of the printer
  string status = 10;
  // Additional details/comments. Can be empty. If filled, maximum length is 250 characters.
  string comment = 11;
  // The audit information about this entity.
  shared.Audit audit = 12;
}

// The enum options of the type of printer for the associated PrinterConnector.
enum PrinterType {
  // Unknown; this is the default value.
  PRINTERTYPE_UNKNOWN = 0;
  // A DIGI Compact printer.
  PRINTERTYPE_DIGI_COMPACT = 1;
  // A DIGI Compact printer High Capacity.
  PRINTERTYPE_DIGI_COMPACT_HC = 2;
  PRINTERTYPE_DIGI_7 = 3;
  PRINTERTYPE_DIGI_MINI = 4;
  PRINTERTYPE_DIGI_COMPACT_SIMULATOR = 5;
  PRINTERTYPE_DIGI_TESTBED = 6;
}

// The subscribe request 
message SubscribeOnPrinterConnectorUpdated {
  repeated string filter_printer_connector_ids = 1;
}

message PrinterConnectorUpdated {
  PrinterConnector printer_connector = 1;
}

message SubscribeOnPrinterConnectorCreated {
  repeated string filter_printer_connector_ids = 1;
}

message PrinterConnectorCreated{
  PrinterConnector printer_connector = 1;
}

message SubscribeOnPrinterConnectorDeleted {
  repeated string filter_printer_connector_ids = 1;
}

message PrinterConnectorDeleted{
  PrinterConnector printer_connector = 1;
}

// Service for retrieving historic data about a printer connector.
// Note: this service is considered EXPERIMENTAL and may change or become obsolete in the (near) future!
service PrinterHistoryService {
    
  /*
  Endpoint for getting all the historic printer job states in the system.

  Returns on a success:
  - list of historic printer job states

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListPrintJobStatusHistory (ListPrintJobStatusHistoryRequest) returns (ListPrintJobStatusHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/job_status_history"
    };
  }

  /*
  Endpoint for getting a single historic printer job status in the system.

  Returns on a success:
  - historic printer job status

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetPrintJobStatusHistory (GetPrintJobStatusHistoryRequest) returns (GetPrintJobStatusHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/job_status_history/{id}"
    };
  }  

  /*
  Endpoint for subscribing on an event when a new PrintJobStatusHistory is created.

  This endpoint provides a real-time stream of newly created PrintJobStatusHistories in the system.
  Clients can optionally filter which PrintJobStatusHistories they want to receive creation notifications for.

  Returns on a success:
    - a stream of PrintJobStatusHistoryCreated messages containing the newly created PrintJobStatusHistory; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrintJobStatusHistoryCreated (SubscribeOnPrintJobStatusHistoryCreated) returns (stream PrintJobStatusHistoryCreated) {

  }
  
  /*
  Endpoint for getting all the historic printer states in the system.

  Returns on a success:
  - list of historic printer states

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListPrinterStatusHistory (ListPrinterStatusHistoryRequest) returns (ListPrinterStatusHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/printer_status_history"
    };
  }
  
  /*
  Endpoint for getting a single historic printer status in the system.

  Returns on a success:
  - historic printer status

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetPrinterStatusHistory (GetPrinterStatusHistoryRequest) returns (GetPrinterStatusHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/printer_status_history/{id}"
    };
  }

  /*
  Endpoint for subscribing on an event when a new PrinterStatusHistory is created.

  This endpoint provides a real-time stream of newly created PrinterStatusHistories in the system.
  Clients can optionally filter which PrinterStatusHistories they want to receive creation notifications for.

  Returns on a success:
    - a stream of PrinterStatusHistoryCreated messages containing the newly created PrinterStatusHistory; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrinterStatusHistoryCreated (SubscribeOnPrinterStatusHistoryCreated) returns (stream PrinterStatusHistoryCreated) {

  }
  
  /*
  Endpoint for getting all the historic printer notifications in the system.

  Returns on a success:
  - list of historic printer notifications

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListNotificationHistory (ListNotificationHistoryRequest) returns (ListNotificationHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/notification_history"
    };
  }
  
  /*
  Endpoint for getting a single historic printer notification in the system.

  Returns on a success:
  - historic printer notification

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetNotificationHistory (GetNotificationHistoryRequest) returns (GetNotificationHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/notification_history/{id}"
    };
  }

  /*
  Endpoint for subscribing on an event when a new NotificationHistory is created.

  This endpoint provides a real-time stream of newly created NotificationHistories in the system.
  Clients can optionally filter which NotificationHistories they want to receive creation notifications for.

  Returns on a success:
    - a stream of NotificationHistoryCreated messages containing the newly created NotificationHistory; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnNotificationHistoryCreated (SubscribeOnNotificationHistoryCreated) returns (stream NotificationHistoryCreated) {

  }
  
  /*
  Endpoint for getting all the historic printjob request parameters in the system.

  Returns on a success:
  - list of historic printjob request parameters

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc ListPrintJobRequestParametersHistory (ListPrintJobRequestParametersHistoryRequest) returns (ListPrintJobRequestParametersHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/print_job_request_parameters_history"
    };
  }
  
  /*
  Endpoint for getting a single historic printjob request parameters in the system.

  Returns on a success:
  - historic printjob request parameters

  Returns on a failure:
  - CANCELLED (1) status when you abort the call
  - PERMISSION_DENIED (7) status when you do not have the right role
  - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
  - UNAUTHENTICATED (16) status when you do not provide the required access token
  */
  rpc GetPrintJobRequestParametersHistory (GetPrintJobRequestParametersHistoryRequest) returns (GetPrintJobRequestParametersHistoryReply) {
    option (google.api.http) = {
      get: "/printergateway_module/v1/printer_history/print_job_request_parameters_history/{id}"
    };
  }

  /*
  Endpoint for subscribing on an event when a new PrintJobRequestParametersHistory is created.

  This endpoint provides a real-time stream of newly created PrintJobRequestParametersHistories in the system.
  Clients can optionally filter which PrintJobRequestParametersHistories they want to receive creation notifications for.

  Returns on a success:
    - a stream of PrintJobRequestParametersHistoryCreated messages containing the newly created PrintJobRequestParametersHistory; OK status (0)

  Returns on a failure:
    - CANCELLED (1) status when you abort the call
    - INTERNAL (13) status when something went wrong on the server (please contact your administrator in this case)
    - UNAUTHENTICATED (16) status when you do not provide a valid access token (when Authentication is enabled)
  */
  rpc OnPrintJobRequestParametersHistoryCreated (SubscribeOnPrintJobRequestParametersHistoryCreated) returns (stream PrintJobRequestParametersHistoryCreated) {

  }
}

message GetPrintJobStatusHistoryRequest {
  // The id of the specific history.    
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
}

message GetPrinterStatusHistoryRequest {
  // The id of the specific history.    
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
}

message GetNotificationHistoryRequest {
  // The id of the specific history.    
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
}

message GetPrintJobRequestParametersHistoryRequest {
  // The id of the specific history.    
  string id = 1 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
}

message ListPrintJobStatusHistoryRequest {
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 1;
  // The starting from date for the history period.    
  google.protobuf.Timestamp from_date = 2;
  // The ending to date for the history period.  
  google.protobuf.Timestamp to_date = 3;
  // Paging options
  shared.PagingRequest paging = 4;
  // The sorting direction
  bool descending = 5;
}

message ListPrinterStatusHistoryRequest {
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 1;
  // The starting from date for the history period.    
  google.protobuf.Timestamp from_date = 2;
  // The ending to date for the history period.  
  google.protobuf.Timestamp to_date = 3;
  // Paging options
  shared.PagingRequest paging = 4;
  // The sorting direction
  bool descending = 5;
}

message ListNotificationHistoryRequest {
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 1;
  // The starting from date for the history period.    
  google.protobuf.Timestamp from_date = 2;
  // The ending to date for the history period.  
  google.protobuf.Timestamp to_date = 3;
  // Paging options
  shared.PagingRequest paging = 4;
  // The sorting direction
  bool descending = 5;
}

message ListPrintJobRequestParametersHistoryRequest {
  // The printer connector id where the history is retrieved from.
  string printer_connector_id = 1;
  // The starting from date for the history period.    
  google.protobuf.Timestamp from_date = 2;
  // The ending to date for the history period.  
  google.protobuf.Timestamp to_date = 3;
  // Paging options
  shared.PagingRequest paging = 4;
  // The sorting direction
  bool descending = 5;
}

message ListPrintJobStatusHistoryReply {
  // List of historic Job Status
  repeated JobStatusHistory job_status_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
  // Paging information
  shared.PagingReply paging = 4;
}

message GetPrintJobStatusHistoryReply {
  // Historic Job Status
  JobStatusHistory job_status = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
}

// wrapper message around printer.JobStatusResponse to also include Audit Info
message JobStatusHistory {
  // Job Status Reply 
  printer.JobStatusResponse job_status = 1;
  // The audit information about this entity.
  shared.Audit audit = 2;
}

message ListPrinterStatusHistoryReply {
  // List of historic Printer Status
  repeated PrinterStatusHistory printer_status_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
  // Paging information
  shared.PagingReply paging = 4;
}

message GetPrinterStatusHistoryReply {
  // Historic Printer Status
  PrinterStatusHistory printer_status_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
}

// wrapper message around printer.PrinterStatus to also include Audit Info
message PrinterStatusHistory {
  // Printer Status Reply 
  printer.PrinterStatus printer_status = 1;
  // The audit information about this entity.
  shared.Audit audit = 2;
}

// wrapper message around printer.Notification to also include Audit Info
message NotificationHistory {
  // Printer Notification
  printer.Notification notification = 1;
  // The audit information about this entity.
  shared.Audit audit = 2;
}

message ListNotificationHistoryReply {
  // List of historic notifications
  repeated NotificationHistory notification_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
  // Paging information
  shared.PagingReply paging = 4;
}

message GetNotificationHistoryReply {
  // Historic notification
  NotificationHistory notification_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
}

message ListPrintJobRequestParametersHistoryReply {
  // List of historic PrintJobRequestParameters
  repeated PrintJobRequestParametersHistory print_job_request_parameters_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
  // Paging information
  shared.PagingReply paging = 4;
}

message GetPrintJobRequestParametersHistoryReply {
  // Historic PrintJobRequestParameters
  PrintJobRequestParametersHistory print_job_request_parameters_history = 1;
  // The printer connector id
  string connector_id = 2 [(proto_options.field_attributes) = IS_GUID];
  // The printer connector
  PrinterConnector connector = 3;
}

message PrintJobRequestParametersHistory {
  // PrintJob request parameters object
  printer.PrintJobRequestParameters print_job_request_parameters = 1;
  // The audit information about this entity.
  shared.Audit audit = 2;
}

message SubscribeOnPrintJobStatusHistoryCreated {
  repeated string filter_print_job_status_history_ids = 1;
}

message PrintJobStatusHistoryCreated{
  JobStatusHistory print_job_status_history = 1;
}

message SubscribeOnPrinterStatusHistoryCreated {
  repeated string filter_printer_status_history_ids = 1;
}

message PrinterStatusHistoryCreated{
  PrinterStatusHistory printer_status_history = 1;
}

message SubscribeOnNotificationHistoryCreated {
  repeated string filter_notification_history_ids = 1;
}

message NotificationHistoryCreated{
  NotificationHistory notification_history = 1;
}

message SubscribeOnPrintJobRequestParametersHistoryCreated {
  repeated string filter_print_job_request_parameters_history_ids = 1;
}

message PrintJobRequestParametersHistoryCreated{
  PrintJobRequestParametersHistory print_job_request_parameters_history = 1;
}

