// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "object_db.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 { DateTime } from "./shared";
/**
 *
 * object in cassandra DB
 *
 * @generated from protobuf message api.ObjectDB
 */
export interface ObjectDB {
    /**
     * @generated from protobuf field: string project = 1;
     */
    project: string;
    /**
     * @generated from protobuf field: string id = 2;
     */
    id: string;
    /**
     * @generated from protobuf field: api.DateTime lastEventTS = 3;
     */
    lastEventTS?: DateTime;
    /**
     * @generated from protobuf field: string lastEventName = 4;
     */
    lastEventName: string;
    /**
     * @generated from protobuf field: bytes entity = 5;
     */
    entity: Uint8Array;
}
// @generated message type with reflection information, may provide speed optimized methods
class ObjectDB$Type extends MessageType<ObjectDB> {
    constructor() {
        super("api.ObjectDB", [
            { no: 1, name: "project", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "lastEventTS", kind: "message", T: () => DateTime },
            { no: 4, name: "lastEventName", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "entity", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
        ]);
    }
    create(value?: PartialMessage<ObjectDB>): ObjectDB {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.project = "";
        message.id = "";
        message.lastEventName = "";
        message.entity = new Uint8Array(0);
        if (value !== undefined)
            reflectionMergePartial<ObjectDB>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ObjectDB): ObjectDB {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string project */ 1:
                    message.project = reader.string();
                    break;
                case /* string id */ 2:
                    message.id = reader.string();
                    break;
                case /* api.DateTime lastEventTS */ 3:
                    message.lastEventTS = DateTime.internalBinaryRead(reader, reader.uint32(), options, message.lastEventTS);
                    break;
                case /* string lastEventName */ 4:
                    message.lastEventName = reader.string();
                    break;
                case /* bytes entity */ 5:
                    message.entity = reader.bytes();
                    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: ObjectDB, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string project = 1; */
        if (message.project !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.project);
        /* string id = 2; */
        if (message.id !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.id);
        /* api.DateTime lastEventTS = 3; */
        if (message.lastEventTS)
            DateTime.internalBinaryWrite(message.lastEventTS, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* string lastEventName = 4; */
        if (message.lastEventName !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.lastEventName);
        /* bytes entity = 5; */
        if (message.entity.length)
            writer.tag(5, WireType.LengthDelimited).bytes(message.entity);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ObjectDB
 */
export const ObjectDB = new ObjectDB$Type();
