// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "metadata.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";
import { EntityID } from "./shared";
import { EventHeader } from "./shared";
/**
 *
 * Aggregation object message
 *
 * @generated from protobuf message api.Metadata
 */
export interface Metadata {
    /**
     * @generated from protobuf field: api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"];
     */
    lastEventHeader?: EventHeader;
    /**
     * @generated from protobuf field: api.EntityID ID = 2 [json_name = "ID"];
     */
    iD?: EntityID;
    /**
     * @generated from protobuf field: api.MetadataPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: MetadataPayload;
}
/**
 * @generated from protobuf message api.MetadataPayload
 */
export interface MetadataPayload {
    /**
     * The segmentation keys are used to complete the segmentation criteria of the project stock. They also apply to order lines and stock movements
     *
     * @generated from protobuf field: bool IsSegmentationKey = 2 [json_name = "IsSegmentationKey"];
     */
    isSegmentationKey: boolean;
    /**
     * @generated from protobuf field: string Domain = 3 [json_name = "Domain"];
     */
    domain: string;
    /**
     * Entity where the metadata will be created. It can be \"executionflow\", \"handlingunit\", \"item\", \"order\", \"stock\"
     *
     * @generated from protobuf field: string Entity = 4 [json_name = "Entity"];
     */
    entity: string;
    /**
     * Where the metadata is located, either \"Payload.Metadata\" or \"Payload.Goods.SegmentationKeys\"
     *
     * @generated from protobuf field: string Parent = 5 [json_name = "Parent"];
     */
    parent: string;
    /**
     * @generated from protobuf field: string Name = 6 [json_name = "Name"];
     */
    name: string;
    /**
     * Type attached to the metadata, can be anything such as string, bool, enum...
     *
     * @generated from protobuf field: string Type = 7 [json_name = "Type"];
     */
    type: string;
    /**
     * @generated from protobuf field: bool IsMandatory = 8 [json_name = "IsMandatory"];
     */
    isMandatory: boolean;
    /**
     * @generated from protobuf field: string RegularExpression = 10 [json_name = "RegularExpression"];
     */
    regularExpression: string;
    /**
     * @generated from protobuf field: api.MetadataType Typology = 11 [json_name = "Typology"];
     */
    typology: MetadataType;
    /**
     * Customizable enumeration
     *
     * @generated from protobuf field: repeated string Enumeration = 12 [json_name = "Enumeration"];
     */
    enumeration: string[];
    /**
     * @generated from protobuf field: api.MetadataStatusStruct Status = 13 [json_name = "Status"];
     */
    status?: MetadataStatusStruct; // Status field is not accessible from APIs
    /**
     * @generated from protobuf field: api.MetadataDisplayType ShowOnCreation = 14 [json_name = "ShowOnCreation"];
     */
    showOnCreation: MetadataDisplayType;
}
/**
 *
 * 	Metadata entity status structure
 *
 * @generated from protobuf message api.MetadataStatus
 */
export interface MetadataStatus {
    /**
     * @generated from protobuf field: api.MetadataStatusCode StatusCode = 1 [json_name = "StatusCode"];
     */
    statusCode: MetadataStatusCode;
    /**
     * @generated from protobuf field: string Date = 2 [json_name = "Date"];
     */
    date: string;
    /**
     * Status effective date. Set by the event's RefDate that triggered the status change.
     *
     * @generated from protobuf field: api.DateTime ActualDate = 3 [json_name = "ActualDate"];
     */
    actualDate?: DateTime;
}
/**
 *
 * 	MetadataStatusStruct statuses structure
 *
 * @generated from protobuf message api.MetadataStatusStruct
 */
export interface MetadataStatusStruct {
    /**
     * @generated from protobuf field: api.MetadataStatus Current = 1 [json_name = "Current"];
     */
    current?: MetadataStatus; // Current status of the Metadata entity
    /**
     * @generated from protobuf field: repeated api.MetadataStatus History = 2 [json_name = "History"];
     */
    history: MetadataStatus[]; // List of all status history of the Metadata entity
    /**
     * @generated from protobuf field: string CreationDate = 3 [json_name = "CreationDate"];
     */
    creationDate: string;
}
/**
 * @generated from protobuf message api.MetadataTriplet
 */
export interface MetadataTriplet {
    /**
     * @generated from protobuf field: api.Metadata Current = 1 [json_name = "Current"];
     */
    current?: Metadata;
    /**
     * @generated from protobuf field: api.Metadata Previous = 2 [json_name = "Previous"];
     */
    previous?: Metadata;
    /**
     * @generated from protobuf field: api.Metadata LastEvent = 3 [json_name = "LastEvent"];
     */
    lastEvent?: Metadata;
}
/**
 * @generated from protobuf message api.MetadatasToApply
 */
export interface MetadatasToApply {
    /**
     * @generated from protobuf field: string Parent = 1 [json_name = "Parent"];
     */
    parent: string;
    /**
     * @generated from protobuf field: api.Metadata Metadata = 2 [json_name = "Metadata"];
     */
    metadata?: Metadata;
}
// _common_

/**
 * @generated from protobuf enum api.MetadataType
 */
export enum MetadataType {
    /**
     * @generated from protobuf enum value: TYPE_UNKNOWN = 0;
     */
    TYPE_UNKNOWN = 0,
    /**
     * @generated from protobuf enum value: TYPE_STRING = 1;
     */
    TYPE_STRING = 1,
    /**
     * @generated from protobuf enum value: TYPE_INTEGER = 2;
     */
    TYPE_INTEGER = 2,
    /**
     * @generated from protobuf enum value: TYPE_BOOLEAN = 3;
     */
    TYPE_BOOLEAN = 3,
    /**
     * @generated from protobuf enum value: TYPE_FLOAT = 4;
     */
    TYPE_FLOAT = 4,
    /**
     * @generated from protobuf enum value: TYPE_TIMESTAMP = 5;
     */
    TYPE_TIMESTAMP = 5
}
/**
 * @generated from protobuf enum api.MetadataDisplayType
 */
export enum MetadataDisplayType {
    /**
     * @generated from protobuf enum value: DISPLAY_UNKNOWN = 0;
     */
    DISPLAY_UNKNOWN = 0,
    /**
     * @generated from protobuf enum value: DISPLAY_ALWAYS = 1;
     */
    DISPLAY_ALWAYS = 1,
    /**
     * @generated from protobuf enum value: DISPLAY_NEVER = 2;
     */
    DISPLAY_NEVER = 2
}
/**
 *
 * 	All statuses for Metadata entity
 *
 * @generated from protobuf enum api.MetadataStatusCode
 */
export enum MetadataStatusCode {
    /**
     * @generated from protobuf enum value: METADATA_0000_UNKNOWN = 0;
     */
    METADATA_0000_UNKNOWN = 0,
    /**
     * @generated from protobuf enum value: METADATA_1000_ACTIVE = 1000;
     */
    METADATA_1000_ACTIVE = 1000,
    /**
     * @generated from protobuf enum value: METADATA_9000_CANCELLED = 9000;
     */
    METADATA_9000_CANCELLED = 9000
}
// @generated message type with reflection information, may provide speed optimized methods
class Metadata$Type extends MessageType<Metadata> {
    constructor() {
        super("api.Metadata", [
            { no: 1, name: "LastEventHeader", kind: "message", jsonName: "LastEventHeader", T: () => EventHeader },
            { no: 2, name: "ID", kind: "message", jsonName: "ID", T: () => EntityID },
            { no: 3, name: "Payload", kind: "message", jsonName: "Payload", T: () => MetadataPayload }
        ]);
    }
    create(value?: PartialMessage<Metadata>): Metadata {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<Metadata>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Metadata): Metadata {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"];*/ 1:
                    message.lastEventHeader = EventHeader.internalBinaryRead(reader, reader.uint32(), options, message.lastEventHeader);
                    break;
                case /* api.EntityID ID = 2 [json_name = "ID"];*/ 2:
                    message.iD = EntityID.internalBinaryRead(reader, reader.uint32(), options, message.iD);
                    break;
                case /* api.MetadataPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = MetadataPayload.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    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: Metadata, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"]; */
        if (message.lastEventHeader)
            EventHeader.internalBinaryWrite(message.lastEventHeader, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.EntityID ID = 2 [json_name = "ID"]; */
        if (message.iD)
            EntityID.internalBinaryWrite(message.iD, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.MetadataPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            MetadataPayload.internalBinaryWrite(message.payload, 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.Metadata
 */
export const Metadata = new Metadata$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MetadataPayload$Type extends MessageType<MetadataPayload> {
    constructor() {
        super("api.MetadataPayload", [
            { no: 2, name: "IsSegmentationKey", kind: "scalar", jsonName: "IsSegmentationKey", T: 8 /*ScalarType.BOOL*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "The segmentation keys are used to complete the segmentation criteria of the project stock. They also apply to order lines and stock movements" } } },
            { no: 3, name: "Domain", kind: "scalar", jsonName: "Domain", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { default: "trade" } } },
            { no: 4, name: "Entity", kind: "scalar", jsonName: "Entity", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Entity where the metadata will be created. It can be \"executionflow\", \"handlingunit\", \"item\", \"order\", \"stock\"", example: "\"order\"" } } },
            { no: 5, name: "Parent", kind: "scalar", jsonName: "Parent", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Where the metadata is located, either \"Payload.Metadata\" or \"Payload.Goods.SegmentationKeys\"" } } },
            { no: 6, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "Type", kind: "scalar", jsonName: "Type", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Type attached to the metadata, can be anything such as string, bool, enum..." } } },
            { no: 8, name: "IsMandatory", kind: "scalar", jsonName: "IsMandatory", T: 8 /*ScalarType.BOOL*/ },
            { no: 10, name: "RegularExpression", kind: "scalar", jsonName: "RegularExpression", T: 9 /*ScalarType.STRING*/ },
            { no: 11, name: "Typology", kind: "enum", jsonName: "Typology", T: () => ["api.MetadataType", MetadataType] },
            { no: 12, name: "Enumeration", kind: "scalar", jsonName: "Enumeration", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Customizable enumeration" } } },
            { no: 13, name: "Status", kind: "message", jsonName: "Status", T: () => MetadataStatusStruct, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true } } },
            { no: 14, name: "ShowOnCreation", kind: "enum", jsonName: "ShowOnCreation", T: () => ["api.MetadataDisplayType", MetadataDisplayType] }
        ]);
    }
    create(value?: PartialMessage<MetadataPayload>): MetadataPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.isSegmentationKey = false;
        message.domain = "";
        message.entity = "";
        message.parent = "";
        message.name = "";
        message.type = "";
        message.isMandatory = false;
        message.regularExpression = "";
        message.typology = 0;
        message.enumeration = [];
        message.showOnCreation = 0;
        if (value !== undefined)
            reflectionMergePartial<MetadataPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MetadataPayload): MetadataPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bool IsSegmentationKey = 2 [json_name = "IsSegmentationKey"];*/ 2:
                    message.isSegmentationKey = reader.bool();
                    break;
                case /* string Domain = 3 [json_name = "Domain"];*/ 3:
                    message.domain = reader.string();
                    break;
                case /* string Entity = 4 [json_name = "Entity"];*/ 4:
                    message.entity = reader.string();
                    break;
                case /* string Parent = 5 [json_name = "Parent"];*/ 5:
                    message.parent = reader.string();
                    break;
                case /* string Name = 6 [json_name = "Name"];*/ 6:
                    message.name = reader.string();
                    break;
                case /* string Type = 7 [json_name = "Type"];*/ 7:
                    message.type = reader.string();
                    break;
                case /* bool IsMandatory = 8 [json_name = "IsMandatory"];*/ 8:
                    message.isMandatory = reader.bool();
                    break;
                case /* string RegularExpression = 10 [json_name = "RegularExpression"];*/ 10:
                    message.regularExpression = reader.string();
                    break;
                case /* api.MetadataType Typology = 11 [json_name = "Typology"];*/ 11:
                    message.typology = reader.int32();
                    break;
                case /* repeated string Enumeration = 12 [json_name = "Enumeration"];*/ 12:
                    message.enumeration.push(reader.string());
                    break;
                case /* api.MetadataStatusStruct Status = 13 [json_name = "Status"];*/ 13:
                    message.status = MetadataStatusStruct.internalBinaryRead(reader, reader.uint32(), options, message.status);
                    break;
                case /* api.MetadataDisplayType ShowOnCreation = 14 [json_name = "ShowOnCreation"];*/ 14:
                    message.showOnCreation = 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: MetadataPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* bool IsSegmentationKey = 2 [json_name = "IsSegmentationKey"]; */
        if (message.isSegmentationKey !== false)
            writer.tag(2, WireType.Varint).bool(message.isSegmentationKey);
        /* string Domain = 3 [json_name = "Domain"]; */
        if (message.domain !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.domain);
        /* string Entity = 4 [json_name = "Entity"]; */
        if (message.entity !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.entity);
        /* string Parent = 5 [json_name = "Parent"]; */
        if (message.parent !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.parent);
        /* string Name = 6 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.name);
        /* string Type = 7 [json_name = "Type"]; */
        if (message.type !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.type);
        /* bool IsMandatory = 8 [json_name = "IsMandatory"]; */
        if (message.isMandatory !== false)
            writer.tag(8, WireType.Varint).bool(message.isMandatory);
        /* string RegularExpression = 10 [json_name = "RegularExpression"]; */
        if (message.regularExpression !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.regularExpression);
        /* api.MetadataType Typology = 11 [json_name = "Typology"]; */
        if (message.typology !== 0)
            writer.tag(11, WireType.Varint).int32(message.typology);
        /* repeated string Enumeration = 12 [json_name = "Enumeration"]; */
        for (let i = 0; i < message.enumeration.length; i++)
            writer.tag(12, WireType.LengthDelimited).string(message.enumeration[i]);
        /* api.MetadataStatusStruct Status = 13 [json_name = "Status"]; */
        if (message.status)
            MetadataStatusStruct.internalBinaryWrite(message.status, writer.tag(13, WireType.LengthDelimited).fork(), options).join();
        /* api.MetadataDisplayType ShowOnCreation = 14 [json_name = "ShowOnCreation"]; */
        if (message.showOnCreation !== 0)
            writer.tag(14, WireType.Varint).int32(message.showOnCreation);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.MetadataPayload
 */
export const MetadataPayload = new MetadataPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MetadataStatus$Type extends MessageType<MetadataStatus> {
    constructor() {
        super("api.MetadataStatus", [
            { no: 1, name: "StatusCode", kind: "enum", jsonName: "StatusCode", T: () => ["api.MetadataStatusCode", MetadataStatusCode], options: { "api.indexationType": { Types: [{ Context: "*", Type: "generatedText" }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortText" }] } } },
            { no: 2, name: "Date", kind: "scalar", jsonName: "Date", T: 9 /*ScalarType.STRING*/, options: { "api.indexationType": { Types: [{ Context: "*", Type: "date" }] }, "api.viewType": { Types: [{ Context: "*", Type: "date" }] } } },
            { no: 3, name: "ActualDate", kind: "message", jsonName: "ActualDate", T: () => DateTime, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Status effective date. Set by the event's RefDate that triggered the status change." } } }
        ]);
    }
    create(value?: PartialMessage<MetadataStatus>): MetadataStatus {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.statusCode = 0;
        message.date = "";
        if (value !== undefined)
            reflectionMergePartial<MetadataStatus>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MetadataStatus): MetadataStatus {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.MetadataStatusCode StatusCode = 1 [json_name = "StatusCode"];*/ 1:
                    message.statusCode = reader.int32();
                    break;
                case /* string Date = 2 [json_name = "Date"];*/ 2:
                    message.date = reader.string();
                    break;
                case /* api.DateTime ActualDate = 3 [json_name = "ActualDate"];*/ 3:
                    message.actualDate = DateTime.internalBinaryRead(reader, reader.uint32(), options, message.actualDate);
                    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: MetadataStatus, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.MetadataStatusCode StatusCode = 1 [json_name = "StatusCode"]; */
        if (message.statusCode !== 0)
            writer.tag(1, WireType.Varint).int32(message.statusCode);
        /* string Date = 2 [json_name = "Date"]; */
        if (message.date !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.date);
        /* api.DateTime ActualDate = 3 [json_name = "ActualDate"]; */
        if (message.actualDate)
            DateTime.internalBinaryWrite(message.actualDate, 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.MetadataStatus
 */
export const MetadataStatus = new MetadataStatus$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MetadataStatusStruct$Type extends MessageType<MetadataStatusStruct> {
    constructor() {
        super("api.MetadataStatusStruct", [
            { no: 1, name: "Current", kind: "message", jsonName: "Current", T: () => MetadataStatus },
            { no: 2, name: "History", kind: "message", jsonName: "History", repeat: 1 /*RepeatType.PACKED*/, T: () => MetadataStatus, options: { "api.aggKey": "Date", "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock" }, { Context: "Stock", Group: "stock_extended" }, { Context: "Executionflow", Group: "executionflow" }, { Context: "Order", Group: "order" }] } } },
            { no: 3, name: "CreationDate", kind: "scalar", jsonName: "CreationDate", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { dateIso8601: true } } } }
        ]);
    }
    create(value?: PartialMessage<MetadataStatusStruct>): MetadataStatusStruct {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.history = [];
        message.creationDate = "";
        if (value !== undefined)
            reflectionMergePartial<MetadataStatusStruct>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MetadataStatusStruct): MetadataStatusStruct {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.MetadataStatus Current = 1 [json_name = "Current"];*/ 1:
                    message.current = MetadataStatus.internalBinaryRead(reader, reader.uint32(), options, message.current);
                    break;
                case /* repeated api.MetadataStatus History = 2 [json_name = "History"];*/ 2:
                    message.history.push(MetadataStatus.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* string CreationDate = 3 [json_name = "CreationDate"];*/ 3:
                    message.creationDate = 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: MetadataStatusStruct, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.MetadataStatus Current = 1 [json_name = "Current"]; */
        if (message.current)
            MetadataStatus.internalBinaryWrite(message.current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.MetadataStatus History = 2 [json_name = "History"]; */
        for (let i = 0; i < message.history.length; i++)
            MetadataStatus.internalBinaryWrite(message.history[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* string CreationDate = 3 [json_name = "CreationDate"]; */
        if (message.creationDate !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.creationDate);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.MetadataStatusStruct
 */
export const MetadataStatusStruct = new MetadataStatusStruct$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MetadataTriplet$Type extends MessageType<MetadataTriplet> {
    constructor() {
        super("api.MetadataTriplet", [
            { no: 1, name: "Current", kind: "message", jsonName: "Current", T: () => Metadata },
            { no: 2, name: "Previous", kind: "message", jsonName: "Previous", T: () => Metadata },
            { no: 3, name: "LastEvent", kind: "message", jsonName: "LastEvent", T: () => Metadata }
        ]);
    }
    create(value?: PartialMessage<MetadataTriplet>): MetadataTriplet {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<MetadataTriplet>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MetadataTriplet): MetadataTriplet {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.Metadata Current = 1 [json_name = "Current"];*/ 1:
                    message.current = Metadata.internalBinaryRead(reader, reader.uint32(), options, message.current);
                    break;
                case /* api.Metadata Previous = 2 [json_name = "Previous"];*/ 2:
                    message.previous = Metadata.internalBinaryRead(reader, reader.uint32(), options, message.previous);
                    break;
                case /* api.Metadata LastEvent = 3 [json_name = "LastEvent"];*/ 3:
                    message.lastEvent = Metadata.internalBinaryRead(reader, reader.uint32(), options, message.lastEvent);
                    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: MetadataTriplet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.Metadata Current = 1 [json_name = "Current"]; */
        if (message.current)
            Metadata.internalBinaryWrite(message.current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.Metadata Previous = 2 [json_name = "Previous"]; */
        if (message.previous)
            Metadata.internalBinaryWrite(message.previous, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Metadata LastEvent = 3 [json_name = "LastEvent"]; */
        if (message.lastEvent)
            Metadata.internalBinaryWrite(message.lastEvent, 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.MetadataTriplet
 */
export const MetadataTriplet = new MetadataTriplet$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MetadatasToApply$Type extends MessageType<MetadatasToApply> {
    constructor() {
        super("api.MetadatasToApply", [
            { no: 1, name: "Parent", kind: "scalar", jsonName: "Parent", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "Metadata", kind: "message", jsonName: "Metadata", T: () => Metadata }
        ]);
    }
    create(value?: PartialMessage<MetadatasToApply>): MetadatasToApply {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.parent = "";
        if (value !== undefined)
            reflectionMergePartial<MetadatasToApply>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MetadatasToApply): MetadatasToApply {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Parent = 1 [json_name = "Parent"];*/ 1:
                    message.parent = reader.string();
                    break;
                case /* api.Metadata Metadata = 2 [json_name = "Metadata"];*/ 2:
                    message.metadata = Metadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
                    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: MetadatasToApply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Parent = 1 [json_name = "Parent"]; */
        if (message.parent !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.parent);
        /* api.Metadata Metadata = 2 [json_name = "Metadata"]; */
        if (message.metadata)
            Metadata.internalBinaryWrite(message.metadata, 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.MetadatasToApply
 */
export const MetadatasToApply = new MetadatasToApply$Type();
