toDeviceDto method

DeviceDto toDeviceDto()

Implementation

DeviceDto toDeviceDto() => DeviceDto(
  id: this.id?.also((it) {
    if (!Uuid.isValidUUID(fromString: it)) {
      throw FormatException("Invalid id, id must be a valid UUID");
    }
  }) ??
      uuid.v4(options: {'rng': UuidUtil.cryptoRNG}),
  tags: this.labels.map((it) => it.toCodeStubDto()).toSet(),
  codes: this.codes.map((it) => it.toCodeStubDto()).toSet(),
  properties: this.properties.map((it) => it.toPropertyStubDto()).toSet(),
  rev: this.rev,
  deletionDate: this.deletionDate,
  name: this.name,
  externalId: this.externalId,
  parentId: this.parentId,
  picture: this.picture,
  type: this.type,
  brand: this.brand,
  model: this.model,
  serialNumber: this.serialNumber,
  publicKey: this.systemMetaData?.publicKey,
  hcPartyKeys: this.systemMetaData?.hcPartyKeys ?? const {},
  privateKeyShamirPartitions: this.systemMetaData?.privateKeyShamirPartitions ?? const {},
  aesExchangeKeys: this.systemMetaData?.aesExchangeKeys ?? const {},
  transferKeys: this.systemMetaData?.transferKeys ?? const {},
);