# Class PatientPumpObservationConverter

Namespace
  adas_core.Infrastructure.Utils

Assembly
  adas-core.Infrastructure.dll

Provides JSON conversion for PumpObservation instances and supports BSON serialization through the MongoDB.Bson.Serialization.IBsonSerializer interface.

    public class PatientPumpObservationConverter : JsonConverter<PumpObservation>, IBsonSerializer

Inheritance
  object
  JsonConverter
  JsonConverter<PumpObservation>
  PatientPumpObservationConverter

Implements
  IBsonSerializer

Inherited Members
  JsonConverter<PumpObservation>.ReadJson(JsonReader, Type, object, JsonSerializer)
  JsonConverter<PumpObservation>.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?)

## 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 provided 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 containing additional settings for the operation.

#### Returns

object

  The deserialized object.

#### Exceptions

NotImplementedException

  Thrown when the method is invoked, as the deserialization logic has not been implemented.

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

Deserializes a JSON representation into a PumpObservation instance. This implementation is not yet provided and always throws an exception.

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

#### Parameters

`reader` JsonReader

  The Newtonsoft.Json.JsonReader to read JSON from.

`objectType` Type

  The type of the object to deserialize.

`existingValue` PumpObservation

  The existing value of the object being read, or `null` if there is no existing value.

`hasExistingValue` bool

  A value indicating whether `existingValue` has a value.

`serializer` JsonSerializer

  The Newtonsoft.Json.JsonSerializer used for deserialization.

#### Returns

PumpObservation

  A PumpObservation instance reconstructed from the JSON data.

#### Exceptions

NotImplementedException

  Thrown because the method has not been implemented yet.

### Serialize(BsonSerializationContext, BsonSerializationArgs, object)

Serializes the specified value into BSON format using the provided serialization context and arguments. This method is not yet implemented and currently throws an exception when invoked.

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

#### Parameters

`context` BsonSerializationContext

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

`args` BsonSerializationArgs

  The BSON serialization arguments that influence the serialization behavior.

`value` object

  The object to be serialized into BSON.

#### Exceptions

NotImplementedException

  Thrown because the method has not been implemented.

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

Serializes the specified value to JSON, applying string enum conversion to the Event, Status, PumpMode, InfusingStatus, and AlarmMode properties. No output is written when the value is null.

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

#### Parameters

`writer` JsonWriter

  The JSON writer to which the serialized object is written.

`value` object

  The object to serialize; if null, the method does nothing.

`serializer` JsonSerializer

  The JSON serializer used as context for the conversion.

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

Serializes a PumpObservation instance to JSON. This override is not yet implemented and will always throw.

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

#### Parameters

`writer` JsonWriter

  The JSON writer used to emit the serialized output.

`value` PumpObservation

  The PumpObservation to serialize, or null if no value is available.

`serializer` JsonSerializer

  The Newtonsoft.Json.JsonSerializer providing serialization context and options.

#### Exceptions

NotImplementedException

  Always thrown because the method has not been implemented.