// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "nsc-base.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 { NatsCredentials } from "./shared";
/**
 * @generated from protobuf message api.NscPermission
 */
export interface NscPermission {
    /**
     * @generated from protobuf field: repeated string allowSub = 1;
     */
    allowSub: string[];
    /**
     * @generated from protobuf field: repeated string allowPub = 2;
     */
    allowPub: string[];
    /**
     * @generated from protobuf field: repeated string denySub = 3;
     */
    denySub: string[];
    /**
     * @generated from protobuf field: repeated string denyPub = 4;
     */
    denyPub: string[];
}
/**
 * @generated from protobuf message api.NamedNscCredentials
 */
export interface NamedNscCredentials {
    /**
     * @generated from protobuf field: string name = 1;
     */
    name: string;
    /**
     * @generated from protobuf field: api.NatsCredentials NscCredentials = 2 [json_name = "NscCredentials"];
     */
    nscCredentials?: NatsCredentials;
}
// @generated message type with reflection information, may provide speed optimized methods
class NscPermission$Type extends MessageType<NscPermission> {
    constructor() {
        super("api.NscPermission", [
            { no: 1, name: "allowSub", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "allowPub", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "denySub", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "denyPub", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<NscPermission>): NscPermission {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.allowSub = [];
        message.allowPub = [];
        message.denySub = [];
        message.denyPub = [];
        if (value !== undefined)
            reflectionMergePartial<NscPermission>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: NscPermission): NscPermission {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated string allowSub */ 1:
                    message.allowSub.push(reader.string());
                    break;
                case /* repeated string allowPub */ 2:
                    message.allowPub.push(reader.string());
                    break;
                case /* repeated string denySub */ 3:
                    message.denySub.push(reader.string());
                    break;
                case /* repeated string denyPub */ 4:
                    message.denyPub.push(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: NscPermission, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated string allowSub = 1; */
        for (let i = 0; i < message.allowSub.length; i++)
            writer.tag(1, WireType.LengthDelimited).string(message.allowSub[i]);
        /* repeated string allowPub = 2; */
        for (let i = 0; i < message.allowPub.length; i++)
            writer.tag(2, WireType.LengthDelimited).string(message.allowPub[i]);
        /* repeated string denySub = 3; */
        for (let i = 0; i < message.denySub.length; i++)
            writer.tag(3, WireType.LengthDelimited).string(message.denySub[i]);
        /* repeated string denyPub = 4; */
        for (let i = 0; i < message.denyPub.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.denyPub[i]);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.NscPermission
 */
export const NscPermission = new NscPermission$Type();
// @generated message type with reflection information, may provide speed optimized methods
class NamedNscCredentials$Type extends MessageType<NamedNscCredentials> {
    constructor() {
        super("api.NamedNscCredentials", [
            { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "NscCredentials", kind: "message", jsonName: "NscCredentials", T: () => NatsCredentials }
        ]);
    }
    create(value?: PartialMessage<NamedNscCredentials>): NamedNscCredentials {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.name = "";
        if (value !== undefined)
            reflectionMergePartial<NamedNscCredentials>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: NamedNscCredentials): NamedNscCredentials {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string name */ 1:
                    message.name = reader.string();
                    break;
                case /* api.NatsCredentials NscCredentials = 2 [json_name = "NscCredentials"];*/ 2:
                    message.nscCredentials = NatsCredentials.internalBinaryRead(reader, reader.uint32(), options, message.nscCredentials);
                    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: NamedNscCredentials, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string name = 1; */
        if (message.name !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.name);
        /* api.NatsCredentials NscCredentials = 2 [json_name = "NscCredentials"]; */
        if (message.nscCredentials)
            NatsCredentials.internalBinaryWrite(message.nscCredentials, 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.NamedNscCredentials
 */
export const NamedNscCredentials = new NamedNscCredentials$Type();
