# frozen_string_literal: true# Copyright (c) 2020-2023 Comet Licensing Ltd.# Please see the LICENSE file for usage information.## SPDX-License-Identifier: MITrequire'json'moduleComet# ServerMetaVersionInfo is a typed class wrapper around the underlying Comet Server API data structure.classServerMetaVersionInfo# @type [String] versionattr_accessor:version# @type [String] version_codenameattr_accessor:version_codename# @type [Boolean] storage_roleattr_accessor:storage_role# @type [Boolean] authentication_roleattr_accessor:authentication_role# @type [Boolean] software_build_roleattr_accessor:software_build_role# @type [Boolean] constellation_role__legacy# @deprecated This member has been deprecated since Comet version 18.2.0 "Overseer Role" was the old name for the Constellation Role. This field is a duplicate of ConstellationRole for backward compatibility with earlier API consumers.attr_accessor:constellation_role__legacy# @type [Boolean] constellation_roleattr_accessor:constellation_role# @type [Array<String>] experimental_optionsattr_accessor:experimental_options# Unix timestamp, in seconds.# @type [Number] server_start_timeattr_accessor:server_start_time# A GUID that was randomly generated when this Comet Server started up. You can check this value to# see if the Comet Server has restarted.# @type [String] server_start_hashattr_accessor:server_start_hash# The current time on the Comet Server host machine. Unix timestamp, in seconds. You can check this# value to see if clock drift is occuring.# @type [Number] current_timeattr_accessor:current_time# A hash derived from the Comet Server's serial number. You can check this value to see if two Comet# Server endpoints point to an identical server.# @type [String] server_license_hashattr_accessor:server_license_hash# @type [Boolean] server_license_features_allattr_accessor:server_license_features_all# @type [Number] server_license_feature_setattr_accessor:server_license_feature_set# Unix timestamp, in seconds.# @type [Number] license_valid_untilattr_accessor:license_valid_until# @type [Number] emails_sent_successfullyattr_accessor:emails_sent_successfully# @type [Number] emails_sent_errorsattr_accessor:emails_sent_errors# @type [Number] emails_waiting_in_queueattr_accessor:emails_waiting_in_queue# @type [Number] scheduled_email_thread_current_stateattr_accessor:scheduled_email_thread_current_state# @type [Number] scheduled_email_thread_last_calculate_duration_nanosattr_accessor:scheduled_email_thread_last_calculate_duration_nanos# @type [Number] scheduled_email_thread_waiting_untilattr_accessor:scheduled_email_thread_waiting_until# @type [Number] scheduled_email_thread_last_wake_timeattr_accessor:scheduled_email_thread_last_wake_time# @type [Boolean] scheduled_email_thread_last_wake_sent_emailsattr_accessor:scheduled_email_thread_last_wake_sent_emails# This field is available in Comet 21.3.2 and later.# @type [Array<Comet::SelfBackupStatistics>] self_backupattr_accessor:self_backup# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operationsattr_accessor:unknown_json_fieldsdefinitializeclearenddefclear@version=''@version_codename=''@experimental_options=[]@server_start_time=0@server_start_hash=''@current_time=0@server_license_hash=''@server_license_feature_set=0@license_valid_until=0@emails_sent_successfully=0@emails_sent_errors=0@emails_waiting_in_queue=0@scheduled_email_thread_current_state=0@scheduled_email_thread_last_calculate_duration_nanos=0@scheduled_email_thread_waiting_until=0@scheduled_email_thread_last_wake_time=0@self_backup=[]@unknown_json_fields={}end# @param [String] json_string The complete object in JSON formatdeffrom_json(json_string)raiseTypeError,"'json_string' expected String, got #{json_string.class}"unlessjson_string.is_a?Stringfrom_hash(JSON.parse(json_string))end# @param [Hash] obj The complete object as a Ruby hashdeffrom_hash(obj)raiseTypeError,"'obj' expected Hash, got #{obj.class}"unlessobj.is_a?Hashobj.eachdo|k,v|casekwhen'Version'raiseTypeError,"'v' expected String, got #{v.class}"unlessv.is_a?String@version=vwhen'VersionCodename'raiseTypeError,"'v' expected String, got #{v.class}"unlessv.is_a?String@version_codename=vwhen'StorageRole'@storage_role=vwhen'AuthenticationRole'@authentication_role=vwhen'SoftwareBuildRole'@software_build_role=vwhen'OverseerRole'@constellation_role__legacy=vwhen'ConstellationRole'@constellation_role=vwhen'ExperimentalOptions'ifv.nil?@experimental_options=[]else@experimental_options=Array.new(v.length)v.each_with_indexdo|v1,i1|raiseTypeError,"'v1' expected String, got #{v1.class}"unlessv1.is_a?String@experimental_options[i1]=v1endendwhen'ServerStartTime'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@server_start_time=vwhen'ServerStartHash'raiseTypeError,"'v' expected String, got #{v.class}"unlessv.is_a?String@server_start_hash=vwhen'CurrentTime'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@current_time=vwhen'ServerLicenseHash'raiseTypeError,"'v' expected String, got #{v.class}"unlessv.is_a?String@server_license_hash=vwhen'ServerLicenseFeaturesAll'@server_license_features_all=vwhen'ServerLicenseFeatureSet'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@server_license_feature_set=vwhen'LicenseValidUntil'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@license_valid_until=vwhen'EmailsSentSuccessfully'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@emails_sent_successfully=vwhen'EmailsSentErrors'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@emails_sent_errors=vwhen'EmailsWaitingInQueue'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@emails_waiting_in_queue=vwhen'ScheduledEmailThreadCurrentState'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@scheduled_email_thread_current_state=vwhen'ScheduledEmailThreadLastCalculateDurationNanos'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@scheduled_email_thread_last_calculate_duration_nanos=vwhen'ScheduledEmailThreadWaitingUntil'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@scheduled_email_thread_waiting_until=vwhen'ScheduledEmailThreadLastWakeTime'raiseTypeError,"'v' expected Numeric, got #{v.class}"unlessv.is_a?Numeric@scheduled_email_thread_last_wake_time=vwhen'ScheduledEmailThreadLastWakeSentEmails'@scheduled_email_thread_last_wake_sent_emails=vwhen'SelfBackup'ifv.nil?@self_backup=[]else@self_backup=Array.new(v.length)v.each_with_indexdo|v1,i1|@self_backup[i1]=Comet::SelfBackupStatistics.new@self_backup[i1].from_hash(v1)endendelse@unknown_json_fields[k]=vendendend# @return [Hash] The complete object as a Ruby hashdefto_hashret={}ret['Version']=@versionret['VersionCodename']=@version_codenameret['StorageRole']=@storage_roleret['AuthenticationRole']=@authentication_roleret['SoftwareBuildRole']=@software_build_roleret['OverseerRole']=@constellation_role__legacyret['ConstellationRole']=@constellation_roleunless@experimental_options.nil?ret['ExperimentalOptions']=@experimental_optionsendret['ServerStartTime']=@server_start_timeret['ServerStartHash']=@server_start_hashret['CurrentTime']=@current_timeret['ServerLicenseHash']=@server_license_hashret['ServerLicenseFeaturesAll']=@server_license_features_allret['ServerLicenseFeatureSet']=@server_license_feature_setret['LicenseValidUntil']=@license_valid_untilret['EmailsSentSuccessfully']=@emails_sent_successfullyret['EmailsSentErrors']=@emails_sent_errorsret['EmailsWaitingInQueue']=@emails_waiting_in_queueret['ScheduledEmailThreadCurrentState']=@scheduled_email_thread_current_stateret['ScheduledEmailThreadLastCalculateDurationNanos']=@scheduled_email_thread_last_calculate_duration_nanosret['ScheduledEmailThreadWaitingUntil']=@scheduled_email_thread_waiting_untilret['ScheduledEmailThreadLastWakeTime']=@scheduled_email_thread_last_wake_timeret['ScheduledEmailThreadLastWakeSentEmails']=@scheduled_email_thread_last_wake_sent_emailsret['SelfBackup']=@self_backup@unknown_json_fields.eachdo|k,v|ret[k]=vendretend# @return [Hash] The complete object as a Ruby hashdefto_hto_hashend# @return [String] The complete object as a JSON stringdefto_json(options={})to_hash.to_json(options)endendend