/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { UnexpectedDataError } from "#general";
import { ValidationDatatypeMismatchError } from "../common/ValidationError.js";
import { TlvType } from "./TlvCodec.js";
import { TlvSchema } from "./TlvSchema.js";
class BooleanSchema extends TlvSchema {
  encodeTlvInternal(writer, value, tag) {
    writer.writeTag({ type: TlvType.Boolean, value }, tag);
  }
  decodeTlvInternalValue(_reader, typeLength) {
    if (typeLength.type !== TlvType.Boolean) throw new UnexpectedDataError(`Unexpected type ${typeLength.type}.`);
    return typeLength.value;
  }
  validate(value) {
    if (typeof value !== "boolean")
      throw new ValidationDatatypeMismatchError(`Expected boolean, got ${typeof value}.`);
  }
}
const TlvBoolean = new BooleanSchema();
export {
  BooleanSchema,
  TlvBoolean
};
//# sourceMappingURL=TlvBoolean.js.map
