package com.lingniu.ingest.api.consumer;

public record EnvelopeConsumerRecord(
        String topic,
        int partition,
        long offset,
        String key,
        byte[] payload
) {
    public EnvelopeConsumerRecord {
        topic = topic == null ? "" : topic;
        key = key == null ? "" : key;
        payload = payload == null ? new byte[0] : payload.clone();
    }

    @Override
    public byte[] payload() {
        return payload.clone();
    }
}
