namespace AyCode.Core.Serializers.Binaries;
///
/// Interface for source-generated binary property readers.
/// Implementations bypass the runtime property loop, wrapper lookup, and delegate-based setters.
/// Each generated reader handles all properties of a specific type using direct property access.
///
/// Performance gains over runtime path:
/// - No GetWrapper() dictionary lookup per object (~20-50ns saved)
/// - No property setter delegate calls (~5-8ns/property saved)
/// - No AccessorType switch dispatch (~2-3ns/property saved)
/// - No boxing for value type properties (direct obj.Prop = context.ReadXxx())
/// - No ReadValue dispatch table for known property types
///
internal interface IGeneratedBinaryReader
{
///
/// Creates a new instance and reads all properties from the stream.
/// Handles both markerless (no UseMetadata) and markered wire formats.
/// UseMetadata=true falls back to runtime path (cross-type CacheMap not known at compile time).
///
/// The deserialization context (owns buffer, position, options).
/// Current depth in the object graph.
/// -1 = not cached, 0+ = register at this cache index for ref tracking.
/// Input strategy (ArrayBinaryInput or SequenceBinaryInput).
/// The deserialized object, or null if creation failed.
object? ReadObject(AcBinaryDeserializer.BinaryDeserializationContext context, int depth, int cacheIndex)
where TInput : struct, IBinaryInputBase;
}