# Class PatientObservationAlarmConverter

Namespace
  adas_core.Infrastructure.Utils

Assembly
  adas-core.Infrastructure.dll

Converts PatientObservationAlarm instances to and from JSON representation.

    public class PatientObservationAlarmConverter : JsonConverter<PatientObservationAlarm>, IBsonSerializer

Inheritance
  object
  JsonConverter
  JsonConverter<PatientObservationAlarm>
  PatientObservationAlarmConverter

Implements
  IBsonSerializer

Inherited Members
  JsonConverter<PatientObservationAlarm>.ReadJson(JsonReader, Type, object, JsonSerializer)
  JsonConverter<PatientObservationAlarm>.CanConvert(Type)
  JsonConverter.CanRead
  JsonConverter.CanWrite
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Remarks

Implements MongoDB.Bson.Serialization.IBsonSerializer to provide BSON serialization and deserialization support for PatientObservationAlarm objects.

## Properties

### ValueType

Gets the type of the value.

    public Type ValueType { get; }

#### Property Value

Type

  The type of the value.

## Methods

### Deserialize(BsonDeserializationContext, BsonDeserializationArgs)

Deserializes a BSON value into a .NET object using the supplied deserialization context and arguments.

    public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)

#### Parameters

`context` BsonDeserializationContext

  The BSON deserialization context that provides access to the reader and configuration.

`args` BsonDeserializationArgs

  The deserialization arguments that influence how the value is read and converted.

#### Returns

object

  The deserialized .NET object produced from the BSON input.

#### Exceptions

NotImplementedException

  Always thrown because the deserialization logic has not been implemented yet.

### ReadJson(JsonReader, Type, PatientObservationAlarm?, bool, JsonSerializer)

Deserializes a JSON token into a PatientObservationAlarm instance. Returns `null` when the JSON token is Newtonsoft.Json.JsonToken.Null, otherwise extracts the `value` property from the JSON object and constructs a new alarm, falling back to a default object when the value is missing.

    public override PatientObservationAlarm? ReadJson(JsonReader reader, Type objectType, PatientObservationAlarm? existingValue, bool hasExistingValue, JsonSerializer serializer)

#### Parameters

`reader` JsonReader

  The Newtonsoft.Json.JsonReader positioned at the JSON token to read.

`objectType` Type

  The type of the object being deserialized.

`existingValue` PatientObservationAlarm

  The existing value of the object being deserialized, or `null` if none exists.

`hasExistingValue` bool

  Indicates whether `existingValue` contains a value to be used during deserialization.

`serializer` JsonSerializer

  The Newtonsoft.Json.JsonSerializer used for nested object deserialization.

#### Returns

PatientObservationAlarm

  A PatientObservationAlarm populated from the JSON, or `null` if the JSON token is Newtonsoft.Json.JsonToken.Null.

### Serialize(BsonSerializationContext, BsonSerializationArgs, object)

Serializes the specified value to BSON format using the provided serialization context and arguments.

    public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)

#### Parameters

`context` BsonSerializationContext

  The BSON serialization context that holds the writer and configuration for the serialization operation.

`args` BsonSerializationArgs

  The BSON serialization arguments containing additional information that influences the serialization behavior.

`value` object

  The object to be serialized into BSON.

#### Exceptions

NotImplementedException

  Thrown because the method has not yet been implemented.

### WriteJson(JsonWriter, object?, JsonSerializer)

Serializes the specified object to JSON, applying the Newtonsoft.Json.Converters.StringEnumConverter to the `eventPhase`, `state`, `priority`, and `type` properties, while excluding the `messageTime` and `expired` properties from the output. Does nothing when the `value` is null.

    public void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)

#### Parameters

`writer` JsonWriter

  The Newtonsoft.Json.JsonWriter to which the JSON output is written.

`value` object

  The object to serialize; if null, the method performs no action.

`serializer` JsonSerializer

  The Newtonsoft.Json.JsonSerializer used to assist with the conversion.

### WriteJson(JsonWriter, PatientObservationAlarm?, JsonSerializer)

Writes the JSON representation of a PatientObservationAlarm using the specified writer and serializer.

    public override void WriteJson(JsonWriter writer, PatientObservationAlarm? value, JsonSerializer serializer)

#### Parameters

`writer` JsonWriter

  The JsonWriter to which the JSON output is written.

`value` PatientObservationAlarm

  The PatientObservationAlarm value to serialize.

`serializer` JsonSerializer

  The JsonSerializer used during the serialization process.

#### Exceptions

NotImplementedException

  The method has not been implemented.