eadInt32()) {
            case 1:
                return DeviceType.DESKTOP
            case 2:
                return DeviceType.MOBILE
            case 3:
                return DeviceType.TABLET
            case 4:
                return DeviceType.VR
            case 5:
                return DeviceType.TV
            case 6:
                return DeviceType.UNKNOWN
            default:
                throw new UniFFITypeError("Unknown DeviceType variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value === DeviceType.DESKTOP) {
            dataStream.writeInt32(1);
            return;
        }
        if (value === DeviceType.MOBILE) {
            dataStream.writeInt32(2);
            return;
        }
        if (value === DeviceType.TABLET) {
            dataStream.writeInt32(3);
            return;
        }
        if (value === DeviceType.VR) {
            dataStream.writeInt32(4);
            return;
        }
        if (value === DeviceType.TV) {
            dataStream.writeInt32(5);
            return;
        }
        if (value === DeviceType.UNKNOWN) {
            dataStream.writeInt32(6);
            return;
        }
        throw new UniFFITypeError("Unknown DeviceType variant");
    }

    static computeSize(value) {
        return 4;
    }

    static checkType(value) {
      // Check that the value is a valid enum variant
      if (!this.#validValues.includes(value)) {
          throw new UniFFITypeError(`${value} is not a valid value for DeviceType`);
      }
    }
}




PK