package nano;

import com.google.protobuf.nano.CodedInputByteBufferNano;
import com.google.protobuf.nano.CodedOutputByteBufferNano;
import com.google.protobuf.nano.InternalNano;
import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
import com.google.protobuf.nano.MessageNano;
import com.google.protobuf.nano.WireFormatNano;
import java.io.IOException;
import nano.GetFirstRecordRequest;
import nano.GetGoodsRecordResponse;

/* compiled from: TbsSdkJava */
public interface GetFirstRecordResponse {

    /* compiled from: TbsSdkJava */
    public static final class GetFirstRecord_Response extends MessageNano {

        private static volatile GetFirstRecord_Response[] _emptyArray;

        public GetFirstRecordRequest.GetFirstRecord_Request input;

        public GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] output;

        public GetFirstRecord_Response() {
            clear();
        }

        public static GetFirstRecord_Response[] emptyArray() {
            if (_emptyArray == null) {
                synchronized (InternalNano.LAZY_INIT_LOCK) {
                    try {
                        if (_emptyArray == null) {
                            _emptyArray = new GetFirstRecord_Response[0];
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }
            return _emptyArray;
        }

        public static GetFirstRecord_Response parseFrom(byte[] bArr) throws InvalidProtocolBufferNanoException {
            return (GetFirstRecord_Response) MessageNano.mergeFrom(new GetFirstRecord_Response(), bArr);
        }

        public GetFirstRecord_Response clear() {
            this.input = null;
            this.output = GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail.emptyArray();
            this.cachedSize = -1;
            return this;
        }

        /* access modifiers changed from: protected */
        public int computeSerializedSize() {
            int computeSerializedSize = super.computeSerializedSize();
            GetFirstRecordRequest.GetFirstRecord_Request getFirstRecord_Request = this.input;
            if (getFirstRecord_Request != null) {
                computeSerializedSize += CodedOutputByteBufferNano.computeMessageSize(1, getFirstRecord_Request);
            }
            GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr = this.output;
            if (recordDetailArr != null && recordDetailArr.length > 0) {
                int i10 = 0;
                while (true) {
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr2 = this.output;
                    if (i10 >= recordDetailArr2.length) {
                        break;
                    }
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail recordDetail = recordDetailArr2[i10];
                    if (recordDetail != null) {
                        computeSerializedSize += CodedOutputByteBufferNano.computeMessageSize(2, recordDetail);
                    }
                    i10++;
                }
            }
            return computeSerializedSize;
        }

        public void writeTo(CodedOutputByteBufferNano codedOutputByteBufferNano) throws IOException {
            GetFirstRecordRequest.GetFirstRecord_Request getFirstRecord_Request = this.input;
            if (getFirstRecord_Request != null) {
                codedOutputByteBufferNano.writeMessage(1, getFirstRecord_Request);
            }
            GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr = this.output;
            if (recordDetailArr != null && recordDetailArr.length > 0) {
                int i10 = 0;
                while (true) {
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr2 = this.output;
                    if (i10 >= recordDetailArr2.length) {
                        break;
                    }
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail recordDetail = recordDetailArr2[i10];
                    if (recordDetail != null) {
                        codedOutputByteBufferNano.writeMessage(2, recordDetail);
                    }
                    i10++;
                }
            }
            super.writeTo(codedOutputByteBufferNano);
        }

        public static GetFirstRecord_Response parseFrom(CodedInputByteBufferNano codedInputByteBufferNano) throws IOException {
            return new GetFirstRecord_Response().mergeFrom(codedInputByteBufferNano);
        }

        public GetFirstRecord_Response mergeFrom(CodedInputByteBufferNano codedInputByteBufferNano) throws IOException {
            while (true) {
                int readTag = codedInputByteBufferNano.readTag();
                if (readTag == 0) {
                    return this;
                }
                if (readTag == 10) {
                    if (this.input == null) {
                        this.input = new GetFirstRecordRequest.GetFirstRecord_Request();
                    }
                    codedInputByteBufferNano.readMessage(this.input);
                } else if (readTag == 18) {
                    int repeatedFieldArrayLength = WireFormatNano.getRepeatedFieldArrayLength(codedInputByteBufferNano, 18);
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr = this.output;
                    int length = recordDetailArr == null ? 0 : recordDetailArr.length;
                    int i10 = repeatedFieldArrayLength + length;
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[] recordDetailArr2 = new GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail[i10];
                    if (length != 0) {
                        System.arraycopy(recordDetailArr, 0, recordDetailArr2, 0, length);
                    }
                    while (length < i10 - 1) {
                        GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail recordDetail = new GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail();
                        recordDetailArr2[length] = recordDetail;
                        codedInputByteBufferNano.readMessage(recordDetail);
                        codedInputByteBufferNano.readTag();
                        length++;
                    }
                    GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail recordDetail2 = new GetGoodsRecordResponse.GetGoodsRecord_Response.RecordDetail();
                    recordDetailArr2[length] = recordDetail2;
                    codedInputByteBufferNano.readMessage(recordDetail2);
                    this.output = recordDetailArr2;
                } else if (!WireFormatNano.parseUnknownField(codedInputByteBufferNano, readTag)) {
                    return this;
                }
            }
        }
    }
}
