// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "api.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 { Scope } from "./shared";
import { Module } from "./module";
import { ModuleRegistration } from "./shared";
import { Role } from "./role";
import { ClientAPI } from "./shared";
import { UserUIPermissions } from "./shared";
import { Permission } from "./shared";
import { ResourceType } from "./shared";
// ======= RPC MODELS =======

/**
 * @generated from protobuf message api.GetPermissionsRequest
 */
export interface GetPermissionsRequest {
    /**
     * @generated from protobuf field: api.ResourceType RscType = 1 [json_name = "RscType"];
     */
    rscType: ResourceType;
    /**
     * @generated from protobuf field: string Client = 2 [json_name = "Client"];
     */
    client: string;
    /**
     * @generated from protobuf field: string Service = 3 [json_name = "Service"];
     */
    service: string;
}
/**
 * @generated from protobuf message api.GetPermissionsResult
 */
export interface GetPermissionsResult {
    /**
     * @generated from protobuf field: repeated api.Permission Permissions = 5 [json_name = "Permissions"];
     */
    permissions: Permission[];
}
/**
 * @generated from protobuf message api.GetUIPermissionsRequest
 */
export interface GetUIPermissionsRequest {
    /**
     * @generated from protobuf field: api.ResourceType RscType = 1 [json_name = "RscType"];
     */
    rscType: ResourceType;
    /**
     * @generated from protobuf field: string Client = 2 [json_name = "Client"];
     */
    client: string;
    /**
     * @generated from protobuf field: string Service = 3 [json_name = "Service"];
     */
    service: string;
}
/**
 * @generated from protobuf message api.GetUIPermissionsResult
 */
export interface GetUIPermissionsResult {
    /**
     * @generated from protobuf field: repeated api.Permission Permissions = 1 [json_name = "Permissions"];
     */
    permissions: Permission[];
}
/**
 * @generated from protobuf message api.ListUserUIPermissionsRequest
 */
export interface ListUserUIPermissionsRequest {
    /**
     * @generated from protobuf field: string Client = 2 [json_name = "Client"];
     */
    client: string;
}
/**
 * @generated from protobuf message api.ListUserUIPermissionsResult
 */
export interface ListUserUIPermissionsResult {
    /**
     * @generated from protobuf field: repeated api.UserUIPermissions Permissions = 2 [json_name = "Permissions"];
     */
    permissions: UserUIPermissions[];
}
/**
 * @generated from protobuf message api.RegisterPackageRequest
 */
export interface RegisterPackageRequest {
    /**
     * @generated from protobuf field: string PackageName = 1 [json_name = "PackageName"];
     */
    packageName: string;
    /**
     * @generated from protobuf field: repeated api.ClientAPI Clients = 2 [json_name = "Clients"];
     */
    clients: ClientAPI[];
    /**
     * @generated from protobuf field: bool ForceFullScopeCreation = 3 [json_name = "ForceFullScopeCreation"];
     */
    forceFullScopeCreation: boolean;
    /**
     * @generated from protobuf field: repeated api.Role Roles = 4 [json_name = "Roles"];
     */
    roles: Role[];
    /**
     * @generated from protobuf field: repeated api.ModuleRegistration Workflows = 5 [json_name = "Workflows"];
     */
    workflows: ModuleRegistration[];
    /**
     * @generated from protobuf field: repeated api.Module Modules = 6 [json_name = "Modules"];
     */
    modules: Module[];
}
/**
 * @generated from protobuf message api.RegisterPackageResult
 */
export interface RegisterPackageResult {
}
/**
 * @generated from protobuf message api.CreateScopeRequest
 */
export interface CreateScopeRequest {
    /**
     * @generated from protobuf field: string ModuleName = 1 [json_name = "ModuleName"];
     */
    moduleName: string;
    /**
     * @generated from protobuf field: string Client = 2 [json_name = "Client"];
     */
    client: string;
    /**
     * @generated from protobuf field: api.Scope Scope = 3 [json_name = "Scope"];
     */
    scope?: Scope;
}
/**
 * @generated from protobuf message api.CreateScopeResult
 */
export interface CreateScopeResult {
}
/**
 * @generated from protobuf message api.DeleteScopeRequest
 */
export interface DeleteScopeRequest {
    /**
     * @generated from protobuf field: string ModuleName = 1 [json_name = "ModuleName"];
     */
    moduleName: string;
    /**
     * @generated from protobuf field: string Client = 2 [json_name = "Client"];
     */
    client: string;
    /**
     * @generated from protobuf field: api.Scope Scope = 3 [json_name = "Scope"];
     */
    scope?: Scope;
}
/**
 * @generated from protobuf message api.DeleteScopeResult
 */
export interface DeleteScopeResult {
}
/**
 * @generated from protobuf message api.CleanScopeRequest
 */
export interface CleanScopeRequest {
    /**
     * @generated from protobuf field: string Client = 1 [json_name = "Client"];
     */
    client: string;
    /**
     * @generated from protobuf field: api.Scope Scope = 2 [json_name = "Scope"];
     */
    scope?: Scope;
}
/**
 * @generated from protobuf message api.CleanScopeResult
 */
export interface CleanScopeResult {
}
// @generated message type with reflection information, may provide speed optimized methods
class GetPermissionsRequest$Type extends MessageType<GetPermissionsRequest> {
    constructor() {
        super("api.GetPermissionsRequest", [
            { no: 1, name: "RscType", kind: "enum", jsonName: "RscType", T: () => ["api.ResourceType", ResourceType, "RESOURCE_TYPE_"] },
            { no: 2, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "Service", kind: "scalar", jsonName: "Service", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<GetPermissionsRequest>): GetPermissionsRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.rscType = 0;
        message.client = "";
        message.service = "";
        if (value !== undefined)
            reflectionMergePartial<GetPermissionsRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPermissionsRequest): GetPermissionsRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.ResourceType RscType = 1 [json_name = "RscType"];*/ 1:
                    message.rscType = reader.int32();
                    break;
                case /* string Client = 2 [json_name = "Client"];*/ 2:
                    message.client = reader.string();
                    break;
                case /* string Service = 3 [json_name = "Service"];*/ 3:
                    message.service = 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: GetPermissionsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.ResourceType RscType = 1 [json_name = "RscType"]; */
        if (message.rscType !== 0)
            writer.tag(1, WireType.Varint).int32(message.rscType);
        /* string Client = 2 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.client);
        /* string Service = 3 [json_name = "Service"]; */
        if (message.service !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.service);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.GetPermissionsRequest
 */
export const GetPermissionsRequest = new GetPermissionsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetPermissionsResult$Type extends MessageType<GetPermissionsResult> {
    constructor() {
        super("api.GetPermissionsResult", [
            { no: 5, name: "Permissions", kind: "message", jsonName: "Permissions", repeat: 1 /*RepeatType.PACKED*/, T: () => Permission }
        ]);
    }
    create(value?: PartialMessage<GetPermissionsResult>): GetPermissionsResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.permissions = [];
        if (value !== undefined)
            reflectionMergePartial<GetPermissionsResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPermissionsResult): GetPermissionsResult {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.Permission Permissions = 5 [json_name = "Permissions"];*/ 5:
                    message.permissions.push(Permission.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: GetPermissionsResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.Permission Permissions = 5 [json_name = "Permissions"]; */
        for (let i = 0; i < message.permissions.length; i++)
            Permission.internalBinaryWrite(message.permissions[i], writer.tag(5, 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.GetPermissionsResult
 */
export const GetPermissionsResult = new GetPermissionsResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetUIPermissionsRequest$Type extends MessageType<GetUIPermissionsRequest> {
    constructor() {
        super("api.GetUIPermissionsRequest", [
            { no: 1, name: "RscType", kind: "enum", jsonName: "RscType", T: () => ["api.ResourceType", ResourceType, "RESOURCE_TYPE_"] },
            { no: 2, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "Service", kind: "scalar", jsonName: "Service", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<GetUIPermissionsRequest>): GetUIPermissionsRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.rscType = 0;
        message.client = "";
        message.service = "";
        if (value !== undefined)
            reflectionMergePartial<GetUIPermissionsRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetUIPermissionsRequest): GetUIPermissionsRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.ResourceType RscType = 1 [json_name = "RscType"];*/ 1:
                    message.rscType = reader.int32();
                    break;
                case /* string Client = 2 [json_name = "Client"];*/ 2:
                    message.client = reader.string();
                    break;
                case /* string Service = 3 [json_name = "Service"];*/ 3:
                    message.service = 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: GetUIPermissionsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.ResourceType RscType = 1 [json_name = "RscType"]; */
        if (message.rscType !== 0)
            writer.tag(1, WireType.Varint).int32(message.rscType);
        /* string Client = 2 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.client);
        /* string Service = 3 [json_name = "Service"]; */
        if (message.service !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.service);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.GetUIPermissionsRequest
 */
export const GetUIPermissionsRequest = new GetUIPermissionsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetUIPermissionsResult$Type extends MessageType<GetUIPermissionsResult> {
    constructor() {
        super("api.GetUIPermissionsResult", [
            { no: 1, name: "Permissions", kind: "message", jsonName: "Permissions", repeat: 1 /*RepeatType.PACKED*/, T: () => Permission }
        ]);
    }
    create(value?: PartialMessage<GetUIPermissionsResult>): GetUIPermissionsResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.permissions = [];
        if (value !== undefined)
            reflectionMergePartial<GetUIPermissionsResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetUIPermissionsResult): GetUIPermissionsResult {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.Permission Permissions = 1 [json_name = "Permissions"];*/ 1:
                    message.permissions.push(Permission.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: GetUIPermissionsResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.Permission Permissions = 1 [json_name = "Permissions"]; */
        for (let i = 0; i < message.permissions.length; i++)
            Permission.internalBinaryWrite(message.permissions[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.GetUIPermissionsResult
 */
export const GetUIPermissionsResult = new GetUIPermissionsResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListUserUIPermissionsRequest$Type extends MessageType<ListUserUIPermissionsRequest> {
    constructor() {
        super("api.ListUserUIPermissionsRequest", [
            { no: 2, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } }
        ]);
    }
    create(value?: PartialMessage<ListUserUIPermissionsRequest>): ListUserUIPermissionsRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.client = "";
        if (value !== undefined)
            reflectionMergePartial<ListUserUIPermissionsRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListUserUIPermissionsRequest): ListUserUIPermissionsRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Client = 2 [json_name = "Client"];*/ 2:
                    message.client = 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: ListUserUIPermissionsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Client = 2 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.client);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ListUserUIPermissionsRequest
 */
export const ListUserUIPermissionsRequest = new ListUserUIPermissionsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListUserUIPermissionsResult$Type extends MessageType<ListUserUIPermissionsResult> {
    constructor() {
        super("api.ListUserUIPermissionsResult", [
            { no: 2, name: "Permissions", kind: "message", jsonName: "Permissions", repeat: 1 /*RepeatType.PACKED*/, T: () => UserUIPermissions }
        ]);
    }
    create(value?: PartialMessage<ListUserUIPermissionsResult>): ListUserUIPermissionsResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.permissions = [];
        if (value !== undefined)
            reflectionMergePartial<ListUserUIPermissionsResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListUserUIPermissionsResult): ListUserUIPermissionsResult {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated api.UserUIPermissions Permissions = 2 [json_name = "Permissions"];*/ 2:
                    message.permissions.push(UserUIPermissions.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: ListUserUIPermissionsResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated api.UserUIPermissions Permissions = 2 [json_name = "Permissions"]; */
        for (let i = 0; i < message.permissions.length; i++)
            UserUIPermissions.internalBinaryWrite(message.permissions[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.ListUserUIPermissionsResult
 */
export const ListUserUIPermissionsResult = new ListUserUIPermissionsResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterPackageRequest$Type extends MessageType<RegisterPackageRequest> {
    constructor() {
        super("api.RegisterPackageRequest", [
            { no: 1, name: "PackageName", kind: "scalar", jsonName: "PackageName", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Clients", kind: "message", jsonName: "Clients", repeat: 1 /*RepeatType.PACKED*/, T: () => ClientAPI },
            { no: 3, name: "ForceFullScopeCreation", kind: "scalar", jsonName: "ForceFullScopeCreation", T: 8 /*ScalarType.BOOL*/ },
            { no: 4, name: "Roles", kind: "message", jsonName: "Roles", repeat: 1 /*RepeatType.PACKED*/, T: () => Role },
            { no: 5, name: "Workflows", kind: "message", jsonName: "Workflows", repeat: 1 /*RepeatType.PACKED*/, T: () => ModuleRegistration },
            { no: 6, name: "Modules", kind: "message", jsonName: "Modules", repeat: 1 /*RepeatType.PACKED*/, T: () => Module }
        ]);
    }
    create(value?: PartialMessage<RegisterPackageRequest>): RegisterPackageRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.packageName = "";
        message.clients = [];
        message.forceFullScopeCreation = false;
        message.roles = [];
        message.workflows = [];
        message.modules = [];
        if (value !== undefined)
            reflectionMergePartial<RegisterPackageRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RegisterPackageRequest): RegisterPackageRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string PackageName = 1 [json_name = "PackageName"];*/ 1:
                    message.packageName = reader.string();
                    break;
                case /* repeated api.ClientAPI Clients = 2 [json_name = "Clients"];*/ 2:
                    message.clients.push(ClientAPI.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* bool ForceFullScopeCreation = 3 [json_name = "ForceFullScopeCreation"];*/ 3:
                    message.forceFullScopeCreation = reader.bool();
                    break;
                case /* repeated api.Role Roles = 4 [json_name = "Roles"];*/ 4:
                    message.roles.push(Role.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated api.ModuleRegistration Workflows = 5 [json_name = "Workflows"];*/ 5:
                    message.workflows.push(ModuleRegistration.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated api.Module Modules = 6 [json_name = "Modules"];*/ 6:
                    message.modules.push(Module.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: RegisterPackageRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string PackageName = 1 [json_name = "PackageName"]; */
        if (message.packageName !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.packageName);
        /* repeated api.ClientAPI Clients = 2 [json_name = "Clients"]; */
        for (let i = 0; i < message.clients.length; i++)
            ClientAPI.internalBinaryWrite(message.clients[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* bool ForceFullScopeCreation = 3 [json_name = "ForceFullScopeCreation"]; */
        if (message.forceFullScopeCreation !== false)
            writer.tag(3, WireType.Varint).bool(message.forceFullScopeCreation);
        /* repeated api.Role Roles = 4 [json_name = "Roles"]; */
        for (let i = 0; i < message.roles.length; i++)
            Role.internalBinaryWrite(message.roles[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.ModuleRegistration Workflows = 5 [json_name = "Workflows"]; */
        for (let i = 0; i < message.workflows.length; i++)
            ModuleRegistration.internalBinaryWrite(message.workflows[i], writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.Module Modules = 6 [json_name = "Modules"]; */
        for (let i = 0; i < message.modules.length; i++)
            Module.internalBinaryWrite(message.modules[i], writer.tag(6, 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.RegisterPackageRequest
 */
export const RegisterPackageRequest = new RegisterPackageRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterPackageResult$Type extends MessageType<RegisterPackageResult> {
    constructor() {
        super("api.RegisterPackageResult", []);
    }
    create(value?: PartialMessage<RegisterPackageResult>): RegisterPackageResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<RegisterPackageResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RegisterPackageResult): RegisterPackageResult {
        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: RegisterPackageResult, 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.RegisterPackageResult
 */
export const RegisterPackageResult = new RegisterPackageResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CreateScopeRequest$Type extends MessageType<CreateScopeRequest> {
    constructor() {
        super("api.CreateScopeRequest", [
            { no: 1, name: "ModuleName", kind: "scalar", jsonName: "ModuleName", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 3, name: "Scope", kind: "message", jsonName: "Scope", T: () => Scope, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<CreateScopeRequest>): CreateScopeRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.moduleName = "";
        message.client = "";
        if (value !== undefined)
            reflectionMergePartial<CreateScopeRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreateScopeRequest): CreateScopeRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string ModuleName = 1 [json_name = "ModuleName"];*/ 1:
                    message.moduleName = reader.string();
                    break;
                case /* string Client = 2 [json_name = "Client"];*/ 2:
                    message.client = reader.string();
                    break;
                case /* api.Scope Scope = 3 [json_name = "Scope"];*/ 3:
                    message.scope = Scope.internalBinaryRead(reader, reader.uint32(), options, message.scope);
                    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: CreateScopeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string ModuleName = 1 [json_name = "ModuleName"]; */
        if (message.moduleName !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.moduleName);
        /* string Client = 2 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.client);
        /* api.Scope Scope = 3 [json_name = "Scope"]; */
        if (message.scope)
            Scope.internalBinaryWrite(message.scope, 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.CreateScopeRequest
 */
export const CreateScopeRequest = new CreateScopeRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CreateScopeResult$Type extends MessageType<CreateScopeResult> {
    constructor() {
        super("api.CreateScopeResult", []);
    }
    create(value?: PartialMessage<CreateScopeResult>): CreateScopeResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<CreateScopeResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreateScopeResult): CreateScopeResult {
        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: CreateScopeResult, 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.CreateScopeResult
 */
export const CreateScopeResult = new CreateScopeResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteScopeRequest$Type extends MessageType<DeleteScopeRequest> {
    constructor() {
        super("api.DeleteScopeRequest", [
            { no: 1, name: "ModuleName", kind: "scalar", jsonName: "ModuleName", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 3, name: "Scope", kind: "message", jsonName: "Scope", T: () => Scope, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<DeleteScopeRequest>): DeleteScopeRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.moduleName = "";
        message.client = "";
        if (value !== undefined)
            reflectionMergePartial<DeleteScopeRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteScopeRequest): DeleteScopeRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string ModuleName = 1 [json_name = "ModuleName"];*/ 1:
                    message.moduleName = reader.string();
                    break;
                case /* string Client = 2 [json_name = "Client"];*/ 2:
                    message.client = reader.string();
                    break;
                case /* api.Scope Scope = 3 [json_name = "Scope"];*/ 3:
                    message.scope = Scope.internalBinaryRead(reader, reader.uint32(), options, message.scope);
                    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: DeleteScopeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string ModuleName = 1 [json_name = "ModuleName"]; */
        if (message.moduleName !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.moduleName);
        /* string Client = 2 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.client);
        /* api.Scope Scope = 3 [json_name = "Scope"]; */
        if (message.scope)
            Scope.internalBinaryWrite(message.scope, 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.DeleteScopeRequest
 */
export const DeleteScopeRequest = new DeleteScopeRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteScopeResult$Type extends MessageType<DeleteScopeResult> {
    constructor() {
        super("api.DeleteScopeResult", []);
    }
    create(value?: PartialMessage<DeleteScopeResult>): DeleteScopeResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<DeleteScopeResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteScopeResult): DeleteScopeResult {
        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: DeleteScopeResult, 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.DeleteScopeResult
 */
export const DeleteScopeResult = new DeleteScopeResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CleanScopeRequest$Type extends MessageType<CleanScopeRequest> {
    constructor() {
        super("api.CleanScopeRequest", [
            { no: 1, name: "Client", kind: "scalar", jsonName: "Client", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
            { no: 2, name: "Scope", kind: "message", jsonName: "Scope", T: () => Scope, options: { "validate.rules": { message: { required: true } } } }
        ]);
    }
    create(value?: PartialMessage<CleanScopeRequest>): CleanScopeRequest {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.client = "";
        if (value !== undefined)
            reflectionMergePartial<CleanScopeRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CleanScopeRequest): CleanScopeRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string Client = 1 [json_name = "Client"];*/ 1:
                    message.client = reader.string();
                    break;
                case /* api.Scope Scope = 2 [json_name = "Scope"];*/ 2:
                    message.scope = Scope.internalBinaryRead(reader, reader.uint32(), options, message.scope);
                    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: CleanScopeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string Client = 1 [json_name = "Client"]; */
        if (message.client !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.client);
        /* api.Scope Scope = 2 [json_name = "Scope"]; */
        if (message.scope)
            Scope.internalBinaryWrite(message.scope, 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.CleanScopeRequest
 */
export const CleanScopeRequest = new CleanScopeRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CleanScopeResult$Type extends MessageType<CleanScopeResult> {
    constructor() {
        super("api.CleanScopeResult", []);
    }
    create(value?: PartialMessage<CleanScopeResult>): CleanScopeResult {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<CleanScopeResult>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CleanScopeResult): CleanScopeResult {
        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: CleanScopeResult, 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.CleanScopeResult
 */
export const CleanScopeResult = new CleanScopeResult$Type();
/**
 * @generated ServiceType for protobuf service api.APIService
 */
export const APIService = new ServiceType("api.APIService", [
    { name: "GetPermissions", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Returns the available permissions" }, "api.rscType": "Platform", "api.roles": "Platform.Permission", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: GetPermissionsRequest, O: GetPermissionsResult },
    { name: "GetUIPermissions", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Returns the available UI permissions" }, "api.rscType": "Platform", "api.roles": "Platform.Permission", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: GetUIPermissionsRequest, O: GetUIPermissionsResult },
    { name: "ListUserUIPermissions", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Permissions"], description: "List the user's active UI permissions" }, "api.rscType": "Platform", "api.roles": "", "google.api.method_visibility": { restriction: "SDK" } }, I: ListUserUIPermissionsRequest, O: ListUserUIPermissionsResult },
    { name: "RegisterPackage", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Register a package with its set of Clients and their APIs" }, "api.rscType": "Platform", "api.roles": "Platform.PackageInit", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: RegisterPackageRequest, O: RegisterPackageResult },
    { name: "CreateScope", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Create a new scope. This API is used by the platform to create scopes for specific resources (e.g. projects). Static scopes are created by the platform through the RegisterModule API and are based on a static list." }, "api.rscType": "Platform", "api.roles": "Platform.Scope", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: CreateScopeRequest, O: CreateScopeResult },
    { name: "DeleteScope", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Delete a scope" }, "api.rscType": "Platform", "api.roles": "Platform.Scope", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: DeleteScopeRequest, O: DeleteScopeResult },
    { name: "CleanScope", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["APIs"], description: "Clean a scope from UMA" }, "api.rscType": "Platform", "api.roles": "", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: CleanScopeRequest, O: CleanScopeResult }
], { "api.k8sService": "authorization-server", "api.resourceManager": true });
