export enum FieldType {
  BITS      = 0,
  UINT8     = 1,
  UINT16_LE = 2,
  UINT16_BE = 3,
  UINT32_LE = 4,
  UINT32_BE = 5,
  BYTES     = 6, // 8-bits per value
  WORDS     = 7, // 16-bits per value
  DWORDS    = 8, // 32-bits per value
  QWORDS    = 9, // 64-bits per value
  STRING    = 10,
  C_STRING  = 11, // Null-terminated string
  CHAR      = 12, // Single ASCII character
}

// Interface for the parsed packet segments, used for debugging and testing.
export type PacketStructure = PacketSegment[];

export interface PacketSegment {
  name:   string;
  data:   Uint8Array;
  fields: PacketField[];
}

export interface PacketField {
  type:   FieldType;
  size:   number; // Size in bytes
  name?:  string;
  bits?:  PacketFieldBit[]; // Only for bit fields in FieldType.BITS
  value?: any; // Optional decoded value
}

export interface PacketFieldBit {
  name: string;
  size: number; // Size in bits
}
