// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "options.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";
/**
 * Note: Struct to define in protoc-m0 in managers/struct_model
 *
 * @generated from protobuf message api.KPIGroups
 */
export interface KPIGroups {
    /**
     * @generated from protobuf field: repeated api.KPIGroup Groups = 1 [json_name = "Groups"];
     */
    groups: KPIGroup[];
}
/**
 * @generated from protobuf message api.KPIGroup
 */
export interface KPIGroup {
    /**
     * @generated from protobuf field: string Name = 1 [json_name = "Name"];
     */
    name: string; // Name of the KPI group
    /**
     * @generated from protobuf field: api.KPIGroupType Type = 2 [json_name = "Type"];
     */
    type: KPIGroupType; // Type of the KPI group
    /**
     * @generated from protobuf field: bool Queryable = 3 [json_name = "Queryable"];
     */
    queryable: boolean; // Some tables are not directly queryable
    /**
     * @generated from protobuf field: string GroupToQuery = 4 [json_name = "GroupToQuery"];
     */
    groupToQuery: string; // For non-queryable group, on which group table the request will be executed
    /**
     * @generated from protobuf field: string OrderBy = 5 [json_name = "OrderBy"];
     */
    orderBy: string; // Table OrderBy
    /**
     * @generated from protobuf field: string Engine = 6 [json_name = "Engine"];
     */
    engine: string; // Table engine
    /**
     * @generated from protobuf field: string HeaderColumns = 7 [json_name = "HeaderColumns"];
     */
    headerColumns: string; // Table header columns
    /**
     * @generated from protobuf field: string PartitionBy = 8 [json_name = "PartitionBy"];
     */
    partitionBy: string; // Table PartitionBy
}
/**
 * @generated from protobuf message api.KPIItems
 */
export interface KPIItems {
    /**
     * @generated from protobuf field: repeated api.KPIItem Items = 1 [json_name = "Items"];
     */
    items: KPIItem[];
}
/**
 * @generated from protobuf message api.KPIItem
 */
export interface KPIItem {
    /**
     * @generated from protobuf field: string Context = 1 [json_name = "Context"];
     */
    context: string; // Entity on which the KPI is defined
    /**
     * @generated from protobuf field: string Group = 2 [json_name = "Group"];
     */
    group: string; // Group on which the KPI is defined
    /**
     * @generated from protobuf field: bool Queryable = 3 [json_name = "Queryable"];
     */
    queryable: boolean; // Defined if the KPI is queryable (some kpi are only returns on the result because linked to other, ex on stock_extended : Actor_Name depends on ActorID)
    /**
     * @generated from protobuf field: string GroupToJoin = 4 [json_name = "GroupToJoin"];
     */
    groupToJoin: string; // KPI is used to join another KPI group
    /**
     * @generated from protobuf field: string CustomType = 5 [json_name = "CustomType"];
     */
    customType: string; // Type of the field in the table
}
/**
 * @generated from protobuf message api.FieldTypes
 */
export interface FieldTypes {
    /**
     * @generated from protobuf field: repeated api.FieldType Types = 1 [json_name = "Types"];
     */
    types: FieldType[];
}
/**
 * @generated from protobuf message api.FieldType
 */
export interface FieldType {
    /**
     * @generated from protobuf field: string Context = 1 [json_name = "Context"];
     */
    context: string; // Entity on which the KPI is defined
    /**
     * @generated from protobuf field: string Type = 2 [json_name = "Type"];
     */
    type: string; // Type of the field
}
/**
 * @generated from protobuf enum api.KPIGroupType
 */
export enum KPIGroupType {
    /**
     * @generated from protobuf enum value: KPIGROUP_TYPE_UNKNOWN = 0;
     */
    KPIGROUP_TYPE_UNKNOWN = 0,
    /**
     * Table fed by a entity stream sink job
     *
     * @generated from protobuf enum value: KPIGROUP_TYPE_SINK = 1;
     */
    KPIGROUP_TYPE_SINK = 1,
    /**
     * Table fed by a materialized view on the database
     *
     * @generated from protobuf enum value: KPIGROUP_TYPE_MATERIALIZED = 2;
     */
    KPIGROUP_TYPE_MATERIALIZED = 2,
    /**
     * Virtual table, the request is concretely executed on physical table (GroupToQuery)
     *
     * @generated from protobuf enum value: KPIGROUP_TYPE_VIEW = 3;
     */
    KPIGROUP_TYPE_VIEW = 3
}
// @generated message type with reflection information, may provide speed optimized methods
class KPIGroups$Type extends MessageType<KPIGroups> {
    constructor() {
        super("api.KPIGroups", [
            { no: 1, name: "Groups", kind: "message", jsonName: "Groups", repeat: 1 /*RepeatType.PACKED*/, T: () => KPIGroup }
        ]);
    }
    create(value?: PartialMessage<KPIGroups>): KPIGroups {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.groups = [];
        if (value !== undefined)
            reflectionMergePartial<KPIGroups>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KPIGroups): KPIGroups {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.KPIGroup Groups = 1 [json_name = "Groups"];*/ 1:
                    message.groups.push(KPIGroup.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: KPIGroups, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.KPIGroup Groups = 1 [json_name = "Groups"]; */
        for (let i = 0; i < message.groups.length; i++)
            KPIGroup.internalBinaryWrite(message.groups[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.KPIGroups
 */
export const KPIGroups = new KPIGroups$Type();
// @generated message type with reflection information, may provide speed optimized methods
class KPIGroup$Type extends MessageType<KPIGroup> {
    constructor() {
        super("api.KPIGroup", [
            { no: 1, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "Type", kind: "enum", jsonName: "Type", T: () => ["api.KPIGroupType", KPIGroupType] },
            { no: 3, name: "Queryable", kind: "scalar", jsonName: "Queryable", T: 8 /*ScalarType.BOOL*/ },
            { no: 4, name: "GroupToQuery", kind: "scalar", jsonName: "GroupToQuery", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "OrderBy", kind: "scalar", jsonName: "OrderBy", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "Engine", kind: "scalar", jsonName: "Engine", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "HeaderColumns", kind: "scalar", jsonName: "HeaderColumns", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "PartitionBy", kind: "scalar", jsonName: "PartitionBy", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<KPIGroup>): KPIGroup {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        message.type = 0;
        message.queryable = false;
        message.groupToQuery = "";
        message.orderBy = "";
        message.engine = "";
        message.headerColumns = "";
        message.partitionBy = "";
        if (value !== undefined)
            reflectionMergePartial<KPIGroup>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KPIGroup): KPIGroup {
        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 /* api.KPIGroupType Type = 2 [json_name = "Type"];*/ 2:
                    message.type = reader.int32();
                    break;
                case /* bool Queryable = 3 [json_name = "Queryable"];*/ 3:
                    message.queryable = reader.bool();
                    break;
                case /* string GroupToQuery = 4 [json_name = "GroupToQuery"];*/ 4:
                    message.groupToQuery = reader.string();
                    break;
                case /* string OrderBy = 5 [json_name = "OrderBy"];*/ 5:
                    message.orderBy = reader.string();
                    break;
                case /* string Engine = 6 [json_name = "Engine"];*/ 6:
                    message.engine = reader.string();
                    break;
                case /* string HeaderColumns = 7 [json_name = "HeaderColumns"];*/ 7:
                    message.headerColumns = reader.string();
                    break;
                case /* string PartitionBy = 8 [json_name = "PartitionBy"];*/ 8:
                    message.partitionBy = 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: KPIGroup, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Name = 1 [json_name = "Name"]; */
        if (message.name !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.name);
        /* api.KPIGroupType Type = 2 [json_name = "Type"]; */
        if (message.type !== 0)
            writer.tag(2, WireType.Varint).int32(message.type);
        /* bool Queryable = 3 [json_name = "Queryable"]; */
        if (message.queryable !== false)
            writer.tag(3, WireType.Varint).bool(message.queryable);
        /* string GroupToQuery = 4 [json_name = "GroupToQuery"]; */
        if (message.groupToQuery !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.groupToQuery);
        /* string OrderBy = 5 [json_name = "OrderBy"]; */
        if (message.orderBy !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.orderBy);
        /* string Engine = 6 [json_name = "Engine"]; */
        if (message.engine !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.engine);
        /* string HeaderColumns = 7 [json_name = "HeaderColumns"]; */
        if (message.headerColumns !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.headerColumns);
        /* string PartitionBy = 8 [json_name = "PartitionBy"]; */
        if (message.partitionBy !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.partitionBy);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.KPIGroup
 */
export const KPIGroup = new KPIGroup$Type();
// @generated message type with reflection information, may provide speed optimized methods
class KPIItems$Type extends MessageType<KPIItems> {
    constructor() {
        super("api.KPIItems", [
            { no: 1, name: "Items", kind: "message", jsonName: "Items", repeat: 1 /*RepeatType.PACKED*/, T: () => KPIItem }
        ]);
    }
    create(value?: PartialMessage<KPIItems>): KPIItems {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.items = [];
        if (value !== undefined)
            reflectionMergePartial<KPIItems>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KPIItems): KPIItems {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.KPIItem Items = 1 [json_name = "Items"];*/ 1:
                    message.items.push(KPIItem.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: KPIItems, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.KPIItem Items = 1 [json_name = "Items"]; */
        for (let i = 0; i < message.items.length; i++)
            KPIItem.internalBinaryWrite(message.items[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.KPIItems
 */
export const KPIItems = new KPIItems$Type();
// @generated message type with reflection information, may provide speed optimized methods
class KPIItem$Type extends MessageType<KPIItem> {
    constructor() {
        super("api.KPIItem", [
            { no: 1, name: "Context", kind: "scalar", jsonName: "Context", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "Group", kind: "scalar", jsonName: "Group", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "Queryable", kind: "scalar", jsonName: "Queryable", T: 8 /*ScalarType.BOOL*/ },
            { no: 4, name: "GroupToJoin", kind: "scalar", jsonName: "GroupToJoin", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "CustomType", kind: "scalar", jsonName: "CustomType", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<KPIItem>): KPIItem {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.context = "";
        message.group = "";
        message.queryable = false;
        message.groupToJoin = "";
        message.customType = "";
        if (value !== undefined)
            reflectionMergePartial<KPIItem>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KPIItem): KPIItem {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Context = 1 [json_name = "Context"];*/ 1:
                    message.context = reader.string();
                    break;
                case /* string Group = 2 [json_name = "Group"];*/ 2:
                    message.group = reader.string();
                    break;
                case /* bool Queryable = 3 [json_name = "Queryable"];*/ 3:
                    message.queryable = reader.bool();
                    break;
                case /* string GroupToJoin = 4 [json_name = "GroupToJoin"];*/ 4:
                    message.groupToJoin = reader.string();
                    break;
                case /* string CustomType = 5 [json_name = "CustomType"];*/ 5:
                    message.customType = 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: KPIItem, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Context = 1 [json_name = "Context"]; */
        if (message.context !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.context);
        /* string Group = 2 [json_name = "Group"]; */
        if (message.group !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.group);
        /* bool Queryable = 3 [json_name = "Queryable"]; */
        if (message.queryable !== false)
            writer.tag(3, WireType.Varint).bool(message.queryable);
        /* string GroupToJoin = 4 [json_name = "GroupToJoin"]; */
        if (message.groupToJoin !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.groupToJoin);
        /* string CustomType = 5 [json_name = "CustomType"]; */
        if (message.customType !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.customType);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.KPIItem
 */
export const KPIItem = new KPIItem$Type();
// @generated message type with reflection information, may provide speed optimized methods
class FieldTypes$Type extends MessageType<FieldTypes> {
    constructor() {
        super("api.FieldTypes", [
            { no: 1, name: "Types", kind: "message", jsonName: "Types", repeat: 1 /*RepeatType.PACKED*/, T: () => FieldType }
        ]);
    }
    create(value?: PartialMessage<FieldTypes>): FieldTypes {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.types = [];
        if (value !== undefined)
            reflectionMergePartial<FieldTypes>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FieldTypes): FieldTypes {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.FieldType Types = 1 [json_name = "Types"];*/ 1:
                    message.types.push(FieldType.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: FieldTypes, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.FieldType Types = 1 [json_name = "Types"]; */
        for (let i = 0; i < message.types.length; i++)
            FieldType.internalBinaryWrite(message.types[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.FieldTypes
 */
export const FieldTypes = new FieldTypes$Type();
// @generated message type with reflection information, may provide speed optimized methods
class FieldType$Type extends MessageType<FieldType> {
    constructor() {
        super("api.FieldType", [
            { no: 1, name: "Context", kind: "scalar", jsonName: "Context", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "Type", kind: "scalar", jsonName: "Type", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<FieldType>): FieldType {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.context = "";
        message.type = "";
        if (value !== undefined)
            reflectionMergePartial<FieldType>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FieldType): FieldType {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Context = 1 [json_name = "Context"];*/ 1:
                    message.context = reader.string();
                    break;
                case /* string Type = 2 [json_name = "Type"];*/ 2:
                    message.type = 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: FieldType, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Context = 1 [json_name = "Context"]; */
        if (message.context !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.context);
        /* string Type = 2 [json_name = "Type"]; */
        if (message.type !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.type);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.FieldType
 */
export const FieldType = new FieldType$Type();
