// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "attachmentV2.proto" (package "api", syntax proto3)
// tslint:disable
import { ServiceType } from "@protobuf-ts/runtime-rpc";
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 { ResponseHeader } from "./shared";
import { EntityType } from "./shared";
import { RequestProjectHeader } from "./shared";
import { AttachmentTypeResponseHeader } from "./shared";
import { RequestAttachmentTypeHeader } from "./shared";
import { AttachmentType } from "./shared";
// ========== MODEL MESSAGES ==========

/**
 * @generated from protobuf message api.Attachment
 */
export interface Attachment {
    /**
     * @generated from protobuf field: string ProjectID = 1 [json_name = "ProjectID"];
     */
    projectID: string;
    /**
     * @generated from protobuf field: string Name = 2 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
    /**
     * @generated from protobuf field: api.AttachmentType AttachmentType = 4 [json_name = "AttachmentType"];
     */
    attachmentType?: AttachmentType;
    /**
     * @generated from protobuf field: string URI = 5 [json_name = "URI"];
     */
    uRI: string;
    /**
     * @generated from protobuf field: string MIMEType = 6 [json_name = "MIMEType"];
     */
    mIMEType: string;
    /**
     * @generated from protobuf field: string UploadedAt = 11 [json_name = "UploadedAt"];
     */
    uploadedAt: string;
    /**
     * @generated from protobuf field: api.AttachmentKind Kind = 12 [json_name = "Kind"];
     */
    kind: AttachmentKind;
    /**
     * @generated from protobuf field: string WebURI = 13 [json_name = "WebURI"];
     */
    webURI: string;
}
/**
 * @generated from protobuf message api.FileDataRequest
 */
export interface FileDataRequest {
    /**
     * @generated from protobuf field: string Name = 1 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: bytes Content = 2 [json_name = "Content"];
     */
    content: Uint8Array;
}
/**
 * @generated from protobuf message api.FileDataResponse
 */
export interface FileDataResponse {
    /**
     * @generated from protobuf field: string Name = 1 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string ContentType = 2 [json_name = "ContentType"];
     */
    contentType: string;
    /**
     * @generated from protobuf field: bytes Content = 3 [json_name = "Content"];
     */
    content: Uint8Array;
}
// ========== REQUESTS & RESPONSE MESSAGES ==========

/**
 * Download
 *
 * @generated from protobuf message api.DownloadAttachmentV2Request
 */
export interface DownloadAttachmentV2Request {
    /**
     * @generated from protobuf field: api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestAttachmentTypeHeader;
    /**
     * @generated from protobuf field: string Name = 2 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
}
/**
 * @generated from protobuf message api.DownloadAttachmentV2Response
 */
export interface DownloadAttachmentV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];
     */
    header?: AttachmentTypeResponseHeader;
    /**
     * @generated from protobuf field: api.FileDataResponse File = 1 [json_name = "File"];
     */
    file?: FileDataResponse;
}
/**
 * Upload
 *
 * @generated from protobuf message api.UploadAttachmentV2Request
 */
export interface UploadAttachmentV2Request {
    /**
     * @generated from protobuf field: api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestAttachmentTypeHeader;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
    /**
     * @generated from protobuf field: api.FileDataRequest Attachment = 4 [json_name = "Attachment"];
     */
    attachment?: FileDataRequest;
}
/**
 * @generated from protobuf message api.UploadAttachmentV2Response
 */
export interface UploadAttachmentV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];
     */
    header?: AttachmentTypeResponseHeader;
    /**
     * @generated from protobuf field: api.Attachment Attachment = 1 [json_name = "Attachment"];
     */
    attachment?: Attachment;
}
/**
 * AddLink
 *
 * @generated from protobuf message api.AddLinkV2Request
 */
export interface AddLinkV2Request {
    /**
     * @generated from protobuf field: api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestAttachmentTypeHeader;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
    /**
     * @generated from protobuf field: string Name = 4 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string URI = 5 [json_name = "URI"];
     */
    uRI: string;
}
/**
 * @generated from protobuf message api.AddLinkV2Response
 */
export interface AddLinkV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];
     */
    header?: AttachmentTypeResponseHeader;
    /**
     * @generated from protobuf field: api.Attachment Attachment = 1 [json_name = "Attachment"];
     */
    attachment?: Attachment;
}
/**
 * Delete
 *
 * @generated from protobuf message api.DeleteAttachmentV2Request
 */
export interface DeleteAttachmentV2Request {
    /**
     * @generated from protobuf field: api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestAttachmentTypeHeader;
    /**
     * @generated from protobuf field: string Name = 2 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
}
/**
 * @generated from protobuf message api.DeleteAttachmentV2Response
 */
export interface DeleteAttachmentV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.AttachmentTypeResponseHeader Header = 1 [json_name = "Header"];
     */
    header?: AttachmentTypeResponseHeader;
}
/**
 * List
 *
 * @generated from protobuf message api.ListAttachmentsV2Request
 */
export interface ListAttachmentsV2Request {
    /**
     * @generated from protobuf field: api.RequestProjectHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestProjectHeader;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
    /**
     * @generated from protobuf field: api.EntityType EntityType = 4 [json_name = "EntityType"];
     */
    entityType: EntityType;
}
/**
 * @generated from protobuf message api.ListAttachmentsV2Response
 */
export interface ListAttachmentsV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.ResponseHeader Header = 2 [json_name = "Header"];
     */
    header?: ResponseHeader;
    /**
     * @generated from protobuf field: repeated api.Attachment Attachments = 1 [json_name = "Attachments"];
     */
    attachments: Attachment[];
}
/**
 * Share
 *
 * @generated from protobuf message api.ShareAttachmentV2Request
 */
export interface ShareAttachmentV2Request {
    /**
     * @generated from protobuf field: api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestAttachmentTypeHeader;
    /**
     * @generated from protobuf field: string Name = 2 [json_name = "Name"];
     */
    name: string;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
}
/**
 * @generated from protobuf message api.ShareAttachmentV2Response
 */
export interface ShareAttachmentV2Response {
    /**
     * Header of the response
     *
     * @generated from protobuf field: api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];
     */
    header?: AttachmentTypeResponseHeader;
    /**
     * @generated from protobuf field: string ShareLink = 1 [json_name = "ShareLink"];
     */
    shareLink: string;
}
/**
 * @generated from protobuf message api.DeleteAllAttachmentsV2Request
 */
export interface DeleteAllAttachmentsV2Request {
    /**
     * @generated from protobuf field: api.RequestProjectHeader Header = 1 [json_name = "Header"];
     */
    header?: RequestProjectHeader;
}
/**
 * @generated from protobuf message api.DeleteAllAttachmentsV2Response
 */
export interface DeleteAllAttachmentsV2Response {
}
/**
 * @generated from protobuf enum api.AttachmentKind
 */
export enum AttachmentKind {
    /**
     * @generated from protobuf enum value: ATTACHMENT_KIND_UNKNOWN = 0;
     */
    UNKNOWN = 0,
    /**
     * @generated from protobuf enum value: ATTACHMENT_KIND_FILE = 1;
     */
    FILE = 1,
    /**
     * @generated from protobuf enum value: ATTACHMENT_KIND_LINK = 2;
     */
    LINK = 2
}
// @generated message type with reflection information, may provide speed optimized methods
class Attachment$Type extends MessageType<Attachment> {
    constructor() {
        super("api.Attachment", [
            { no: 1, name: "ProjectID", kind: "scalar", jsonName: "ProjectID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 4, name: "AttachmentType", kind: "message", jsonName: "AttachmentType", T: () => AttachmentType, options: { "validate.rules": { message: { required: true } } } },
            { no: 5, name: "URI", kind: "scalar", jsonName: "URI", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "URI of the attachment through which it can be downloaded (must be authenticated with a bearer token). In case the Attachment is a link, the URI is the link itself." } } },
            { no: 6, name: "MIMEType", kind: "scalar", jsonName: "MIMEType", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 11, name: "UploadedAt", kind: "scalar", jsonName: "UploadedAt", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { dateIso8601: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "UTC date/time in <a href='https://en.wikipedia.org/wiki/ISO_8601'>ISO 8601</a> format" } } },
            { no: 12, name: "Kind", kind: "enum", jsonName: "Kind", T: () => ["api.AttachmentKind", AttachmentKind, "ATTACHMENT_KIND_"], options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Kind of the attachment (file or link)" } } },
            { no: 13, name: "WebURI", kind: "scalar", jsonName: "WebURI", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "URI of the attachment through which it can be accessed on an authenticated web app. In case the Attachment is a link, the URI is empty." } } }
        ]);
    }
    create(value?: PartialMessage<Attachment>): Attachment {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.projectID = "";
        message.name = "";
        message.entityRefID = "";
        message.uRI = "";
        message.mIMEType = "";
        message.uploadedAt = "";
        message.kind = 0;
        message.webURI = "";
        if (value !== undefined)
            reflectionMergePartial<Attachment>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Attachment): Attachment {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string ProjectID = 1 [json_name = "ProjectID"];*/ 1:
                    message.projectID = reader.string();
                    break;
                case /* string Name = 2 [json_name = "Name"];*/ 2:
                    message.name = reader.string();
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    break;
                case /* api.AttachmentType AttachmentType = 4 [json_name = "AttachmentType"];*/ 4:
                    message.attachmentType = AttachmentType.internalBinaryRead(reader, reader.uint32(), options, message.attachmentType);
                    break;
                case /* string URI = 5 [json_name = "URI"];*/ 5:
                    message.uRI = reader.string();
                    break;
                case /* string MIMEType = 6 [json_name = "MIMEType"];*/ 6:
                    message.mIMEType = reader.string();
                    break;
                case /* string UploadedAt = 11 [json_name = "UploadedAt"];*/ 11:
                    message.uploadedAt = reader.string();
                    break;
                case /* api.AttachmentKind Kind = 12 [json_name = "Kind"];*/ 12:
                    message.kind = reader.int32();
                    break;
                case /* string WebURI = 13 [json_name = "WebURI"];*/ 13:
                    message.webURI = reader.string();
                    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: Attachment, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string ProjectID = 1 [json_name = "ProjectID"]; */
        if (message.projectID !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.projectID);
        /* string Name = 2 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        /* api.AttachmentType AttachmentType = 4 [json_name = "AttachmentType"]; */
        if (message.attachmentType)
            AttachmentType.internalBinaryWrite(message.attachmentType, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* string URI = 5 [json_name = "URI"]; */
        if (message.uRI !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.uRI);
        /* string MIMEType = 6 [json_name = "MIMEType"]; */
        if (message.mIMEType !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.mIMEType);
        /* string UploadedAt = 11 [json_name = "UploadedAt"]; */
        if (message.uploadedAt !== "")
            writer.tag(11, WireType.LengthDelimited).string(message.uploadedAt);
        /* api.AttachmentKind Kind = 12 [json_name = "Kind"]; */
        if (message.kind !== 0)
            writer.tag(12, WireType.Varint).int32(message.kind);
        /* string WebURI = 13 [json_name = "WebURI"]; */
        if (message.webURI !== "")
            writer.tag(13, WireType.LengthDelimited).string(message.webURI);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.Attachment
 */
export const Attachment = new Attachment$Type();
// @generated message type with reflection information, may provide speed optimized methods
class FileDataRequest$Type extends MessageType<FileDataRequest> {
    constructor() {
        super("api.FileDataRequest", [
            { no: 1, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Content", kind: "scalar", jsonName: "Content", T: 12 /*ScalarType.BYTES*/ }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Name"] } } });
    }
    create(value?: PartialMessage<FileDataRequest>): FileDataRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.content = new Uint8Array(0);
        if (value !== undefined)
            reflectionMergePartial<FileDataRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FileDataRequest): FileDataRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Name = 1 [json_name = "Name"];*/ 1:
                    message.name = reader.string();
                    break;
                case /* bytes Content = 2 [json_name = "Content"];*/ 2:
                    message.content = 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: FileDataRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Name = 1 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.name);
        /* bytes Content = 2 [json_name = "Content"]; */
        if (message.content.length)
            writer.tag(2, WireType.LengthDelimited).bytes(message.content);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.FileDataRequest
 */
export const FileDataRequest = new FileDataRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class FileDataResponse$Type extends MessageType<FileDataResponse> {
    constructor() {
        super("api.FileDataResponse", [
            { no: 1, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "ContentType", kind: "scalar", jsonName: "ContentType", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "Content", kind: "scalar", jsonName: "Content", T: 12 /*ScalarType.BYTES*/ }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Name"] } } });
    }
    create(value?: PartialMessage<FileDataResponse>): FileDataResponse {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.contentType = "";
        message.content = new Uint8Array(0);
        if (value !== undefined)
            reflectionMergePartial<FileDataResponse>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FileDataResponse): FileDataResponse {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Name = 1 [json_name = "Name"];*/ 1:
                    message.name = reader.string();
                    break;
                case /* string ContentType = 2 [json_name = "ContentType"];*/ 2:
                    message.contentType = reader.string();
                    break;
                case /* bytes Content = 3 [json_name = "Content"];*/ 3:
                    message.content = 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: FileDataResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Name = 1 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.name);
        /* string ContentType = 2 [json_name = "ContentType"]; */
        if (message.contentType !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.contentType);
        /* bytes Content = 3 [json_name = "Content"]; */
        if (message.content.length)
            writer.tag(3, WireType.LengthDelimited).bytes(message.content);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.FileDataResponse
 */
export const FileDataResponse = new FileDataResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DownloadAttachmentV2Request$Type extends MessageType<DownloadAttachmentV2Request> {
    constructor() {
        super("api.DownloadAttachmentV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestAttachmentTypeHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 2, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Name of the attachment to download" } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Identifier of the entity where the attachment is located" } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "Name", "EntityRefID"] } } });
    }
    create(value?: PartialMessage<DownloadAttachmentV2Request>): DownloadAttachmentV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.entityRefID = "";
        if (value !== undefined)
            reflectionMergePartial<DownloadAttachmentV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAttachmentV2Request): DownloadAttachmentV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestAttachmentTypeHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string Name = 2 [json_name = "Name"];*/ 2:
                    message.name = reader.string();
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    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: DownloadAttachmentV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestAttachmentTypeHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string Name = 2 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.DownloadAttachmentV2Request
 */
export const DownloadAttachmentV2Request = new DownloadAttachmentV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DownloadAttachmentV2Response$Type extends MessageType<DownloadAttachmentV2Response> {
    constructor() {
        super("api.DownloadAttachmentV2Response", [
            { no: 2, name: "Header", kind: "message", jsonName: "Header", T: () => AttachmentTypeResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } },
            { no: 1, name: "File", kind: "message", jsonName: "File", T: () => FileDataResponse, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<DownloadAttachmentV2Response>): DownloadAttachmentV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<DownloadAttachmentV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAttachmentV2Response): DownloadAttachmentV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];*/ 2:
                    message.header = AttachmentTypeResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* api.FileDataResponse File = 1 [json_name = "File"];*/ 1:
                    message.file = FileDataResponse.internalBinaryRead(reader, reader.uint32(), options, message.file);
                    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: DownloadAttachmentV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"]; */
        if (message.header)
            AttachmentTypeResponseHeader.internalBinaryWrite(message.header, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.FileDataResponse File = 1 [json_name = "File"]; */
        if (message.file)
            FileDataResponse.internalBinaryWrite(message.file, 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.DownloadAttachmentV2Response
 */
export const DownloadAttachmentV2Response = new DownloadAttachmentV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UploadAttachmentV2Request$Type extends MessageType<UploadAttachmentV2Request> {
    constructor() {
        super("api.UploadAttachmentV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestAttachmentTypeHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Identifier of the entity where the attachment is located" } } },
            { no: 4, name: "Attachment", kind: "message", jsonName: "Attachment", T: () => FileDataRequest, options: { "validate.rules": { message: { required: true } } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "AttachmentTypeID", "EntityRefID", "Attachment"] } } });
    }
    create(value?: PartialMessage<UploadAttachmentV2Request>): UploadAttachmentV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.entityRefID = "";
        if (value !== undefined)
            reflectionMergePartial<UploadAttachmentV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UploadAttachmentV2Request): UploadAttachmentV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestAttachmentTypeHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    break;
                case /* api.FileDataRequest Attachment = 4 [json_name = "Attachment"];*/ 4:
                    message.attachment = FileDataRequest.internalBinaryRead(reader, reader.uint32(), options, message.attachment);
                    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: UploadAttachmentV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestAttachmentTypeHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        /* api.FileDataRequest Attachment = 4 [json_name = "Attachment"]; */
        if (message.attachment)
            FileDataRequest.internalBinaryWrite(message.attachment, writer.tag(4, 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.UploadAttachmentV2Request
 */
export const UploadAttachmentV2Request = new UploadAttachmentV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UploadAttachmentV2Response$Type extends MessageType<UploadAttachmentV2Response> {
    constructor() {
        super("api.UploadAttachmentV2Response", [
            { no: 2, name: "Header", kind: "message", jsonName: "Header", T: () => AttachmentTypeResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } },
            { no: 1, name: "Attachment", kind: "message", jsonName: "Attachment", T: () => Attachment, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<UploadAttachmentV2Response>): UploadAttachmentV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<UploadAttachmentV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UploadAttachmentV2Response): UploadAttachmentV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];*/ 2:
                    message.header = AttachmentTypeResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* api.Attachment Attachment = 1 [json_name = "Attachment"];*/ 1:
                    message.attachment = Attachment.internalBinaryRead(reader, reader.uint32(), options, message.attachment);
                    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: UploadAttachmentV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"]; */
        if (message.header)
            AttachmentTypeResponseHeader.internalBinaryWrite(message.header, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Attachment Attachment = 1 [json_name = "Attachment"]; */
        if (message.attachment)
            Attachment.internalBinaryWrite(message.attachment, 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.UploadAttachmentV2Response
 */
export const UploadAttachmentV2Response = new UploadAttachmentV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AddLinkV2Request$Type extends MessageType<AddLinkV2Request> {
    constructor() {
        super("api.AddLinkV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestAttachmentTypeHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Identifier of the entity where the attachment is located" } } },
            { no: 4, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Name of the link to add to the entity" } } },
            { no: 5, name: "URI", kind: "scalar", jsonName: "URI", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "URI to add to the entity" } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "AttachmentTypeID", "EntityRefID", "Name", "URI"] } } });
    }
    create(value?: PartialMessage<AddLinkV2Request>): AddLinkV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.entityRefID = "";
        message.name = "";
        message.uRI = "";
        if (value !== undefined)
            reflectionMergePartial<AddLinkV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddLinkV2Request): AddLinkV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestAttachmentTypeHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    break;
                case /* string Name = 4 [json_name = "Name"];*/ 4:
                    message.name = reader.string();
                    break;
                case /* string URI = 5 [json_name = "URI"];*/ 5:
                    message.uRI = reader.string();
                    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: AddLinkV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestAttachmentTypeHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        /* string Name = 4 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.name);
        /* string URI = 5 [json_name = "URI"]; */
        if (message.uRI !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.uRI);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.AddLinkV2Request
 */
export const AddLinkV2Request = new AddLinkV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AddLinkV2Response$Type extends MessageType<AddLinkV2Response> {
    constructor() {
        super("api.AddLinkV2Response", [
            { no: 2, name: "Header", kind: "message", jsonName: "Header", T: () => AttachmentTypeResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } },
            { no: 1, name: "Attachment", kind: "message", jsonName: "Attachment", T: () => Attachment, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<AddLinkV2Response>): AddLinkV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<AddLinkV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddLinkV2Response): AddLinkV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];*/ 2:
                    message.header = AttachmentTypeResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* api.Attachment Attachment = 1 [json_name = "Attachment"];*/ 1:
                    message.attachment = Attachment.internalBinaryRead(reader, reader.uint32(), options, message.attachment);
                    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: AddLinkV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"]; */
        if (message.header)
            AttachmentTypeResponseHeader.internalBinaryWrite(message.header, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Attachment Attachment = 1 [json_name = "Attachment"]; */
        if (message.attachment)
            Attachment.internalBinaryWrite(message.attachment, 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.AddLinkV2Response
 */
export const AddLinkV2Response = new AddLinkV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteAttachmentV2Request$Type extends MessageType<DeleteAttachmentV2Request> {
    constructor() {
        super("api.DeleteAttachmentV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestAttachmentTypeHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 2, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Name of the attachment to download" } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Identifier of the entity where the attachment is located" } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "Name", "EntityRefID", "AttachmentTypeID"] } } });
    }
    create(value?: PartialMessage<DeleteAttachmentV2Request>): DeleteAttachmentV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.entityRefID = "";
        if (value !== undefined)
            reflectionMergePartial<DeleteAttachmentV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteAttachmentV2Request): DeleteAttachmentV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestAttachmentTypeHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string Name = 2 [json_name = "Name"];*/ 2:
                    message.name = reader.string();
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    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: DeleteAttachmentV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestAttachmentTypeHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string Name = 2 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.DeleteAttachmentV2Request
 */
export const DeleteAttachmentV2Request = new DeleteAttachmentV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteAttachmentV2Response$Type extends MessageType<DeleteAttachmentV2Response> {
    constructor() {
        super("api.DeleteAttachmentV2Response", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => AttachmentTypeResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } }
        ]);
    }
    create(value?: PartialMessage<DeleteAttachmentV2Response>): DeleteAttachmentV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<DeleteAttachmentV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteAttachmentV2Response): DeleteAttachmentV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.AttachmentTypeResponseHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = AttachmentTypeResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    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: DeleteAttachmentV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.AttachmentTypeResponseHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            AttachmentTypeResponseHeader.internalBinaryWrite(message.header, 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.DeleteAttachmentV2Response
 */
export const DeleteAttachmentV2Response = new DeleteAttachmentV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListAttachmentsV2Request$Type extends MessageType<ListAttachmentsV2Request> {
    constructor() {
        super("api.ListAttachmentsV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestProjectHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Optional : Identifier of the entity where the attachment is located" } } },
            { no: 4, name: "EntityType", kind: "enum", jsonName: "EntityType", T: () => ["api.EntityType", EntityType, "ENTITY_TYPE_"], options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Optional : Type of the entity where the attachment is located" } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header"] } } });
    }
    create(value?: PartialMessage<ListAttachmentsV2Request>): ListAttachmentsV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.entityRefID = "";
        message.entityType = 0;
        if (value !== undefined)
            reflectionMergePartial<ListAttachmentsV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAttachmentsV2Request): ListAttachmentsV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestProjectHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestProjectHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    break;
                case /* api.EntityType EntityType = 4 [json_name = "EntityType"];*/ 4:
                    message.entityType = reader.int32();
                    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: ListAttachmentsV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestProjectHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestProjectHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        /* api.EntityType EntityType = 4 [json_name = "EntityType"]; */
        if (message.entityType !== 0)
            writer.tag(4, WireType.Varint).int32(message.entityType);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ListAttachmentsV2Request
 */
export const ListAttachmentsV2Request = new ListAttachmentsV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListAttachmentsV2Response$Type extends MessageType<ListAttachmentsV2Response> {
    constructor() {
        super("api.ListAttachmentsV2Response", [
            { no: 2, name: "Header", kind: "message", jsonName: "Header", T: () => ResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } },
            { no: 1, name: "Attachments", kind: "message", jsonName: "Attachments", repeat: 1 /*RepeatType.PACKED*/, T: () => Attachment, options: { "validate.rules": { repeated: { minItems: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "List of attachments matching to the request" } } }
        ]);
    }
    create(value?: PartialMessage<ListAttachmentsV2Response>): ListAttachmentsV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.attachments = [];
        if (value !== undefined)
            reflectionMergePartial<ListAttachmentsV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAttachmentsV2Response): ListAttachmentsV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.ResponseHeader Header = 2 [json_name = "Header"];*/ 2:
                    message.header = ResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* repeated api.Attachment Attachments = 1 [json_name = "Attachments"];*/ 1:
                    message.attachments.push(Attachment.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: ListAttachmentsV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.ResponseHeader Header = 2 [json_name = "Header"]; */
        if (message.header)
            ResponseHeader.internalBinaryWrite(message.header, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.Attachment Attachments = 1 [json_name = "Attachments"]; */
        for (let i = 0; i < message.attachments.length; i++)
            Attachment.internalBinaryWrite(message.attachments[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.ListAttachmentsV2Response
 */
export const ListAttachmentsV2Response = new ListAttachmentsV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ShareAttachmentV2Request$Type extends MessageType<ShareAttachmentV2Request> {
    constructor() {
        super("api.ShareAttachmentV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestAttachmentTypeHeader, options: { "validate.rules": { message: { required: true } } } },
            { no: 2, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Name of the attachment to download" } } },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Identifier of the entity where the attachment is located" } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "Name", "EntityRefID", "AttachmentTypeID"] } } });
    }
    create(value?: PartialMessage<ShareAttachmentV2Request>): ShareAttachmentV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.entityRefID = "";
        if (value !== undefined)
            reflectionMergePartial<ShareAttachmentV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ShareAttachmentV2Request): ShareAttachmentV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestAttachmentTypeHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string Name = 2 [json_name = "Name"];*/ 2:
                    message.name = reader.string();
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    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: ShareAttachmentV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestAttachmentTypeHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestAttachmentTypeHeader.internalBinaryWrite(message.header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string Name = 2 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ShareAttachmentV2Request
 */
export const ShareAttachmentV2Request = new ShareAttachmentV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ShareAttachmentV2Response$Type extends MessageType<ShareAttachmentV2Response> {
    constructor() {
        super("api.ShareAttachmentV2Response", [
            { no: 2, name: "Header", kind: "message", jsonName: "Header", T: () => AttachmentTypeResponseHeader, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Header of the response" } } },
            { no: 1, name: "ShareLink", kind: "scalar", jsonName: "ShareLink", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Link to access to the attchment if the sharing policy allows to" } } }
        ]);
    }
    create(value?: PartialMessage<ShareAttachmentV2Response>): ShareAttachmentV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.shareLink = "";
        if (value !== undefined)
            reflectionMergePartial<ShareAttachmentV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ShareAttachmentV2Response): ShareAttachmentV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"];*/ 2:
                    message.header = AttachmentTypeResponseHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* string ShareLink = 1 [json_name = "ShareLink"];*/ 1:
                    message.shareLink = reader.string();
                    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: ShareAttachmentV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.AttachmentTypeResponseHeader Header = 2 [json_name = "Header"]; */
        if (message.header)
            AttachmentTypeResponseHeader.internalBinaryWrite(message.header, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* string ShareLink = 1 [json_name = "ShareLink"]; */
        if (message.shareLink !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.shareLink);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ShareAttachmentV2Response
 */
export const ShareAttachmentV2Response = new ShareAttachmentV2Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteAllAttachmentsV2Request$Type extends MessageType<DeleteAllAttachmentsV2Request> {
    constructor() {
        super("api.DeleteAllAttachmentsV2Request", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => RequestProjectHeader, options: { "validate.rules": { message: { required: true } } } }
        ], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header"] } } });
    }
    create(value?: PartialMessage<DeleteAllAttachmentsV2Request>): DeleteAllAttachmentsV2Request {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<DeleteAllAttachmentsV2Request>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteAllAttachmentsV2Request): DeleteAllAttachmentsV2Request {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.RequestProjectHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = RequestProjectHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    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: DeleteAllAttachmentsV2Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.RequestProjectHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            RequestProjectHeader.internalBinaryWrite(message.header, 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.DeleteAllAttachmentsV2Request
 */
export const DeleteAllAttachmentsV2Request = new DeleteAllAttachmentsV2Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteAllAttachmentsV2Response$Type extends MessageType<DeleteAllAttachmentsV2Response> {
    constructor() {
        super("api.DeleteAllAttachmentsV2Response", []);
    }
    create(value?: PartialMessage<DeleteAllAttachmentsV2Response>): DeleteAllAttachmentsV2Response {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<DeleteAllAttachmentsV2Response>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteAllAttachmentsV2Response): DeleteAllAttachmentsV2Response {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                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: DeleteAllAttachmentsV2Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.DeleteAllAttachmentsV2Response
 */
export const DeleteAllAttachmentsV2Response = new DeleteAllAttachmentsV2Response$Type();
/**
 * @generated ServiceType for protobuf service api.AttachmentServiceV2
 */
export const AttachmentServiceV2 = new ServiceType("api.AttachmentServiceV2", [
    { name: "Upload", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Upload a document attached to an entity. <br>Must be called using a multipart form-data content type request. <br>Example of curl request : curl -H \"Authorization: $TOKEN\" -F \"Attachment=@path/to/my/file/to/upload\" -F \"EntityRefID=myentityrefid\" -F \"AttachmentTypeID=myattachmenttypeid\" https://$REFLEXPLATFORM_REST_URL/api.AttachmentServiceV2/Upload" }, "api.rscType": "AttachmentType", "api.roles": "AttachmentType.Writer", "google.api.method_visibility": { restriction: "SDK" } }, I: UploadAttachmentV2Request, O: UploadAttachmentV2Response },
    { name: "AddLink", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Add a link to an entity." }, "api.rscType": "AttachmentType", "api.roles": "AttachmentType.Writer", "google.api.method_visibility": { restriction: "SDK" } }, I: AddLinkV2Request, O: AddLinkV2Response },
    { name: "Download", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Download a document attached to an entity", consumes: ["application/json"] }, "api.rscType": "AttachmentType", "api.roles": "AttachmentType.Reader", "google.api.method_visibility": { restriction: "SDK" } }, I: DownloadAttachmentV2Request, O: DownloadAttachmentV2Response },
    { name: "Delete", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Delete a document attached to an entity" }, "api.rscType": "AttachmentType", "api.roles": "AttachmentType.Writer", "google.api.method_visibility": { restriction: "SDK" } }, I: DeleteAttachmentV2Request, O: DeleteAttachmentV2Response },
    { name: "List", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "List all documents attached to an entity" }, "api.rscType": "Project", "api.roles": "", "google.api.method_visibility": { restriction: "SDK" } }, I: ListAttachmentsV2Request, O: ListAttachmentsV2Response },
    { name: "Share", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Share a document attached to an entity" }, "api.rscType": "AttachmentType", "api.roles": "AttachmentType.Writer", "google.api.method_visibility": { restriction: "SDK" } }, I: ShareAttachmentV2Request, O: ShareAttachmentV2Response },
    { name: "DeleteAll", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Attachment"], description: "Delete all documents attached to entities within the project" }, "api.rscType": "Project", "api.roles": "Platform.Project-Deletion", "google.api.method_visibility": { restriction: "SDK" } }, I: DeleteAllAttachmentsV2Request, O: DeleteAllAttachmentsV2Response }
], { "api.k8sService": "attachment-server" });
