/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { DataReader, DataWriter, Endian } from "@matter/general";
import { Schema } from "@matter/types";
class BdxCounterOnlyMessageSchema extends Schema {
  encodeInternal(message) {
    const { blockCounter } = message;
    const writer = new DataWriter(Endian.Little);
    writer.writeUInt32(blockCounter);
    return writer.toByteArray();
  }
  decodeInternal(bytes) {
    const reader = new DataReader(bytes, Endian.Little);
    return {
      blockCounter: reader.readUInt32()
    };
  }
}
const BdxCounterOnlyMessage = new BdxCounterOnlyMessageSchema();
const BdxBlockQueryMessage = BdxCounterOnlyMessage;
const BdxBlockAckMessage = BdxCounterOnlyMessage;
const BdxBlockAckEofMessage = BdxCounterOnlyMessage;
class BdxBlockQueryWithSkipMessageSchema extends Schema {
  encodeInternal(message) {
    const { blockCounter, bytesToSkip } = message;
    const writer = new DataWriter(Endian.Little);
    writer.writeUInt32(blockCounter);
    writer.writeUInt64(bytesToSkip);
    return writer.toByteArray();
  }
  decodeInternal(bytes) {
    const reader = new DataReader(bytes, Endian.Little);
    return {
      blockCounter: reader.readUInt32(),
      bytesToSkip: reader.readUInt64()
    };
  }
}
const BdxBlockQueryWithSkipMessage = new BdxBlockQueryWithSkipMessageSchema();
class BdxBlockMessageSchema extends Schema {
  encodeInternal(message) {
    const { blockCounter, data } = message;
    const writer = new DataWriter(Endian.Little);
    writer.writeUInt32(blockCounter);
    writer.writeByteArray(data);
    return writer.toByteArray();
  }
  decodeInternal(bytes) {
    const reader = new DataReader(bytes, Endian.Little);
    return {
      blockCounter: reader.readUInt32(),
      data: reader.remainingBytes
    };
  }
}
const BdxBlockMessage = new BdxBlockMessageSchema();
const BdxBlockEofMessage = BdxBlockMessage;
export {
  BdxBlockAckEofMessage,
  BdxBlockAckMessage,
  BdxBlockEofMessage,
  BdxBlockMessage,
  BdxBlockMessageSchema,
  BdxBlockQueryMessage,
  BdxBlockQueryWithSkipMessage,
  BdxBlockQueryWithSkipMessageSchema,
  BdxCounterOnlyMessageSchema
};
//# sourceMappingURL=BdxBlockMessagesSchema.js.map
