// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "collabClickhouseStatement.proto" (package "api", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { Claim } from "./claim";
import { MetadatasToApply } from "./metadata";
/**
 * ClickHouseInput Proto message for clickhouse streaming process
 *
 * @generated from protobuf message api.CollabClickHouseInput
 */
export interface CollabClickHouseInput {
    /**
     * @generated from protobuf field: api.CollabClickhouseElements ClickhouseElements = 1 [json_name = "ClickhouseElements"];
     */
    clickhouseElements?: CollabClickhouseElements;
    /**
     * @generated from protobuf field: repeated api.MetadatasToApply MetadatasToApply = 2 [json_name = "MetadatasToApply"];
     */
    metadatasToApply: MetadatasToApply[];
}
/**
 * @generated from protobuf message api.CollabClickhouseElement
 */
export interface CollabClickhouseElement {
    /**
     * @generated from protobuf oneof: Content
     */
    content: {
        oneofKind: "claim";
        /**
         * @generated from protobuf field: api.Claim Claim = 1 [json_name = "Claim"];
         */
        claim: Claim;
    } | {
        oneofKind: undefined;
    };
}
/**
 * @generated from protobuf message api.CollabClickhouseElements
 */
export interface CollabClickhouseElements {
    /**
     * @generated from protobuf field: repeated api.CollabClickhouseElement ClickhouseElements = 1 [json_name = "ClickhouseElements"];
     */
    clickhouseElements: CollabClickhouseElement[];
}
/**
 * CollabCheckpointData  Proto message for clickhouse streaming process
 *
 * @generated from protobuf message api.CollabCheckpointData
 */
export interface CollabCheckpointData {
    /**
     * @generated from protobuf field: int64 IdCheckpoint = 1 [json_name = "IdCheckpoint"];
     */
    idCheckpoint: bigint;
    /**
     * @generated from protobuf field: string Project = 2 [json_name = "Project"];
     */
    project: string;
    /**
     * @generated from protobuf field: repeated api.CollabClickHouseInput ClickHouseInput = 3 [json_name = "ClickHouseInput"];
     */
    clickHouseInput: CollabClickHouseInput[];
}
// @generated message type with reflection information, may provide speed optimized methods
class CollabClickHouseInput$Type extends MessageType<CollabClickHouseInput> {
    constructor() {
        super("api.CollabClickHouseInput", [
            { no: 1, name: "ClickhouseElements", kind: "message", jsonName: "ClickhouseElements", T: () => CollabClickhouseElements },
            { no: 2, name: "MetadatasToApply", kind: "message", jsonName: "MetadatasToApply", repeat: 1 /*RepeatType.PACKED*/, T: () => MetadatasToApply }
        ]);
    }
    create(value?: PartialMessage<CollabClickHouseInput>): CollabClickHouseInput {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.metadatasToApply = [];
        if (value !== undefined)
            reflectionMergePartial<CollabClickHouseInput>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CollabClickHouseInput): CollabClickHouseInput {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.CollabClickhouseElements ClickhouseElements = 1 [json_name = "ClickhouseElements"];*/ 1:
                    message.clickhouseElements = CollabClickhouseElements.internalBinaryRead(reader, reader.uint32(), options, message.clickhouseElements);
                    break;
                case /* repeated api.MetadatasToApply MetadatasToApply = 2 [json_name = "MetadatasToApply"];*/ 2:
                    message.metadatasToApply.push(MetadatasToApply.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: CollabClickHouseInput, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.CollabClickhouseElements ClickhouseElements = 1 [json_name = "ClickhouseElements"]; */
        if (message.clickhouseElements)
            CollabClickhouseElements.internalBinaryWrite(message.clickhouseElements, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.MetadatasToApply MetadatasToApply = 2 [json_name = "MetadatasToApply"]; */
        for (let i = 0; i < message.metadatasToApply.length; i++)
            MetadatasToApply.internalBinaryWrite(message.metadatasToApply[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.CollabClickHouseInput
 */
export const CollabClickHouseInput = new CollabClickHouseInput$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CollabClickhouseElement$Type extends MessageType<CollabClickhouseElement> {
    constructor() {
        super("api.CollabClickhouseElement", [
            { no: 1, name: "Claim", kind: "message", jsonName: "Claim", oneof: "content", T: () => Claim }
        ]);
    }
    create(value?: PartialMessage<CollabClickhouseElement>): CollabClickhouseElement {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.content = { oneofKind: undefined };
        if (value !== undefined)
            reflectionMergePartial<CollabClickhouseElement>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CollabClickhouseElement): CollabClickhouseElement {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.Claim Claim = 1 [json_name = "Claim"];*/ 1:
                    message.content = {
                        oneofKind: "claim",
                        claim: Claim.internalBinaryRead(reader, reader.uint32(), options, (message.content as any).claim)
                    };
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: CollabClickhouseElement, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.Claim Claim = 1 [json_name = "Claim"]; */
        if (message.content.oneofKind === "claim")
            Claim.internalBinaryWrite(message.content.claim, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.CollabClickhouseElement
 */
export const CollabClickhouseElement = new CollabClickhouseElement$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CollabClickhouseElements$Type extends MessageType<CollabClickhouseElements> {
    constructor() {
        super("api.CollabClickhouseElements", [
            { no: 1, name: "ClickhouseElements", kind: "message", jsonName: "ClickhouseElements", repeat: 1 /*RepeatType.PACKED*/, T: () => CollabClickhouseElement }
        ]);
    }
    create(value?: PartialMessage<CollabClickhouseElements>): CollabClickhouseElements {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.clickhouseElements = [];
        if (value !== undefined)
            reflectionMergePartial<CollabClickhouseElements>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CollabClickhouseElements): CollabClickhouseElements {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.CollabClickhouseElement ClickhouseElements = 1 [json_name = "ClickhouseElements"];*/ 1:
                    message.clickhouseElements.push(CollabClickhouseElement.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: CollabClickhouseElements, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.CollabClickhouseElement ClickhouseElements = 1 [json_name = "ClickhouseElements"]; */
        for (let i = 0; i < message.clickhouseElements.length; i++)
            CollabClickhouseElement.internalBinaryWrite(message.clickhouseElements[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.CollabClickhouseElements
 */
export const CollabClickhouseElements = new CollabClickhouseElements$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CollabCheckpointData$Type extends MessageType<CollabCheckpointData> {
    constructor() {
        super("api.CollabCheckpointData", [
            { no: 1, name: "IdCheckpoint", kind: "scalar", jsonName: "IdCheckpoint", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 2, name: "Project", kind: "scalar", jsonName: "Project", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "ClickHouseInput", kind: "message", jsonName: "ClickHouseInput", repeat: 1 /*RepeatType.PACKED*/, T: () => CollabClickHouseInput }
        ]);
    }
    create(value?: PartialMessage<CollabCheckpointData>): CollabCheckpointData {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.idCheckpoint = 0n;
        message.project = "";
        message.clickHouseInput = [];
        if (value !== undefined)
            reflectionMergePartial<CollabCheckpointData>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CollabCheckpointData): CollabCheckpointData {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* int64 IdCheckpoint = 1 [json_name = "IdCheckpoint"];*/ 1:
                    message.idCheckpoint = reader.int64().toBigInt();
                    break;
                case /* string Project = 2 [json_name = "Project"];*/ 2:
                    message.project = reader.string();
                    break;
                case /* repeated api.CollabClickHouseInput ClickHouseInput = 3 [json_name = "ClickHouseInput"];*/ 3:
                    message.clickHouseInput.push(CollabClickHouseInput.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: CollabCheckpointData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* int64 IdCheckpoint = 1 [json_name = "IdCheckpoint"]; */
        if (message.idCheckpoint !== 0n)
            writer.tag(1, WireType.Varint).int64(message.idCheckpoint);
        /* string Project = 2 [json_name = "Project"]; */
        if (message.project !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.project);
        /* repeated api.CollabClickHouseInput ClickHouseInput = 3 [json_name = "ClickHouseInput"]; */
        for (let i = 0; i < message.clickHouseInput.length; i++)
            CollabClickHouseInput.internalBinaryWrite(message.clickHouseInput[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.CollabCheckpointData
 */
export const CollabCheckpointData = new CollabCheckpointData$Type();
