"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WafProfileServiceClient = exports.WafProfileServiceService = exports.DeleteWafProfileMetadata = exports.DeleteWafProfileRequest = exports.UpdateWafProfileMetadata = exports.UpdateWafProfileRequest_LabelsEntry = exports.UpdateWafProfileRequest = exports.CreateWafProfileMetadata = exports.CreateWafProfileRequest_LabelsEntry = exports.CreateWafProfileRequest = exports.ListWafProfilesResponse = exports.ListWafProfilesRequest = exports.GetWafProfileRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const waf_profile_1 = require("../../../../../yandex/cloud/smartwebsecurity/v1/waf/waf_profile");
const field_mask_1 = require("../../../../../google/protobuf/field_mask");
const operation_1 = require("../../../../../yandex/cloud/operation/operation");
exports.protobufPackage = 'yandex.cloud.smartwebsecurity.v1.waf';
const baseGetWafProfileRequest = { wafProfileId: '' };
exports.GetWafProfileRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseGetWafProfileRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetWafProfileRequest);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetWafProfileRequest);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListWafProfilesRequest = { folderId: '' };
exports.ListWafProfilesRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListWafProfilesRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListWafProfilesRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListWafProfilesRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListWafProfilesResponse = {};
exports.ListWafProfilesResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.wafProfiles) {
            waf_profile_1.WafProfile.encode(v, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListWafProfilesResponse);
        message.wafProfiles = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfiles.push(waf_profile_1.WafProfile.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListWafProfilesResponse);
        message.wafProfiles = ((_a = object.wafProfiles) !== null && _a !== void 0 ? _a : []).map((e) => waf_profile_1.WafProfile.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.wafProfiles) {
            obj.wafProfiles = message.wafProfiles.map((e) => e ? waf_profile_1.WafProfile.toJSON(e) : undefined);
        }
        else {
            obj.wafProfiles = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListWafProfilesResponse);
        message.wafProfiles = ((_a = object.wafProfiles) === null || _a === void 0 ? void 0 : _a.map((e) => waf_profile_1.WafProfile.fromPartial(e))) || [];
        return message;
    },
};
const baseCreateWafProfileRequest = { folderId: '', name: '', description: '' };
exports.CreateWafProfileRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreateWafProfileRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(34).fork()).ldelim();
        });
        for (const v of message.rules) {
            waf_profile_1.WafProfileRule.encode(v, writer.uint32(42).fork()).ldelim();
        }
        for (const v of message.exclusionRules) {
            waf_profile_1.WafProfileExclusionRule.encode(v, writer.uint32(50).fork()).ldelim();
        }
        if (message.coreRuleSet !== undefined) {
            waf_profile_1.WafProfile_CoreRuleSet.encode(message.coreRuleSet, writer.uint32(58).fork()).ldelim();
        }
        if (message.analyzeRequestBody !== undefined) {
            waf_profile_1.WafProfile_AnalyzeRequestBody.encode(message.analyzeRequestBody, writer.uint32(66).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreateWafProfileRequest);
        message.labels = {};
        message.rules = [];
        message.exclusionRules = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    const entry4 = exports.CreateWafProfileRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry4.value !== undefined) {
                        message.labels[entry4.key] = entry4.value;
                    }
                    break;
                case 5:
                    message.rules.push(waf_profile_1.WafProfileRule.decode(reader, reader.uint32()));
                    break;
                case 6:
                    message.exclusionRules.push(waf_profile_1.WafProfileExclusionRule.decode(reader, reader.uint32()));
                    break;
                case 7:
                    message.coreRuleSet = waf_profile_1.WafProfile_CoreRuleSet.decode(reader, reader.uint32());
                    break;
                case 8:
                    message.analyzeRequestBody = waf_profile_1.WafProfile_AnalyzeRequestBody.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseCreateWafProfileRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.rules = ((_b = object.rules) !== null && _b !== void 0 ? _b : []).map((e) => waf_profile_1.WafProfileRule.fromJSON(e));
        message.exclusionRules = ((_c = object.exclusionRules) !== null && _c !== void 0 ? _c : []).map((e) => waf_profile_1.WafProfileExclusionRule.fromJSON(e));
        message.coreRuleSet =
            object.coreRuleSet !== undefined && object.coreRuleSet !== null
                ? waf_profile_1.WafProfile_CoreRuleSet.fromJSON(object.coreRuleSet)
                : undefined;
        message.analyzeRequestBody =
            object.analyzeRequestBody !== undefined && object.analyzeRequestBody !== null
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.fromJSON(object.analyzeRequestBody)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        if (message.rules) {
            obj.rules = message.rules.map((e) => (e ? waf_profile_1.WafProfileRule.toJSON(e) : undefined));
        }
        else {
            obj.rules = [];
        }
        if (message.exclusionRules) {
            obj.exclusionRules = message.exclusionRules.map((e) => e ? waf_profile_1.WafProfileExclusionRule.toJSON(e) : undefined);
        }
        else {
            obj.exclusionRules = [];
        }
        message.coreRuleSet !== undefined &&
            (obj.coreRuleSet = message.coreRuleSet
                ? waf_profile_1.WafProfile_CoreRuleSet.toJSON(message.coreRuleSet)
                : undefined);
        message.analyzeRequestBody !== undefined &&
            (obj.analyzeRequestBody = message.analyzeRequestBody
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.toJSON(message.analyzeRequestBody)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f;
        const message = Object.assign({}, baseCreateWafProfileRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.rules = ((_e = object.rules) === null || _e === void 0 ? void 0 : _e.map((e) => waf_profile_1.WafProfileRule.fromPartial(e))) || [];
        message.exclusionRules =
            ((_f = object.exclusionRules) === null || _f === void 0 ? void 0 : _f.map((e) => waf_profile_1.WafProfileExclusionRule.fromPartial(e))) || [];
        message.coreRuleSet =
            object.coreRuleSet !== undefined && object.coreRuleSet !== null
                ? waf_profile_1.WafProfile_CoreRuleSet.fromPartial(object.coreRuleSet)
                : undefined;
        message.analyzeRequestBody =
            object.analyzeRequestBody !== undefined && object.analyzeRequestBody !== null
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.fromPartial(object.analyzeRequestBody)
                : undefined;
        return message;
    },
};
const baseCreateWafProfileRequest_LabelsEntry = { key: '', value: '' };
exports.CreateWafProfileRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreateWafProfileRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreateWafProfileRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseCreateWafProfileRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreateWafProfileMetadata = { wafProfileId: '' };
exports.CreateWafProfileMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreateWafProfileMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreateWafProfileMetadata);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCreateWafProfileMetadata);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpdateWafProfileRequest = { wafProfileId: '', name: '', description: '' };
exports.UpdateWafProfileRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        if (message.updateMask !== undefined) {
            field_mask_1.FieldMask.encode(message.updateMask, writer.uint32(18).fork()).ldelim();
        }
        if (message.name !== '') {
            writer.uint32(26).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(34).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdateWafProfileRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(42).fork()).ldelim();
        });
        for (const v of message.rules) {
            waf_profile_1.WafProfileRule.encode(v, writer.uint32(50).fork()).ldelim();
        }
        for (const v of message.exclusionRules) {
            waf_profile_1.WafProfileExclusionRule.encode(v, writer.uint32(58).fork()).ldelim();
        }
        if (message.coreRuleSet !== undefined) {
            waf_profile_1.WafProfile_CoreRuleSet.encode(message.coreRuleSet, writer.uint32(66).fork()).ldelim();
        }
        if (message.analyzeRequestBody !== undefined) {
            waf_profile_1.WafProfile_AnalyzeRequestBody.encode(message.analyzeRequestBody, writer.uint32(74).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdateWafProfileRequest);
        message.labels = {};
        message.rules = [];
        message.exclusionRules = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                case 2:
                    message.updateMask = field_mask_1.FieldMask.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.name = reader.string();
                    break;
                case 4:
                    message.description = reader.string();
                    break;
                case 5:
                    const entry5 = exports.UpdateWafProfileRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry5.value !== undefined) {
                        message.labels[entry5.key] = entry5.value;
                    }
                    break;
                case 6:
                    message.rules.push(waf_profile_1.WafProfileRule.decode(reader, reader.uint32()));
                    break;
                case 7:
                    message.exclusionRules.push(waf_profile_1.WafProfileExclusionRule.decode(reader, reader.uint32()));
                    break;
                case 8:
                    message.coreRuleSet = waf_profile_1.WafProfile_CoreRuleSet.decode(reader, reader.uint32());
                    break;
                case 9:
                    message.analyzeRequestBody = waf_profile_1.WafProfile_AnalyzeRequestBody.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseUpdateWafProfileRequest);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromJSON(object.updateMask)
                : undefined;
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.rules = ((_b = object.rules) !== null && _b !== void 0 ? _b : []).map((e) => waf_profile_1.WafProfileRule.fromJSON(e));
        message.exclusionRules = ((_c = object.exclusionRules) !== null && _c !== void 0 ? _c : []).map((e) => waf_profile_1.WafProfileExclusionRule.fromJSON(e));
        message.coreRuleSet =
            object.coreRuleSet !== undefined && object.coreRuleSet !== null
                ? waf_profile_1.WafProfile_CoreRuleSet.fromJSON(object.coreRuleSet)
                : undefined;
        message.analyzeRequestBody =
            object.analyzeRequestBody !== undefined && object.analyzeRequestBody !== null
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.fromJSON(object.analyzeRequestBody)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        message.updateMask !== undefined &&
            (obj.updateMask = message.updateMask
                ? field_mask_1.FieldMask.toJSON(message.updateMask)
                : undefined);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        if (message.rules) {
            obj.rules = message.rules.map((e) => (e ? waf_profile_1.WafProfileRule.toJSON(e) : undefined));
        }
        else {
            obj.rules = [];
        }
        if (message.exclusionRules) {
            obj.exclusionRules = message.exclusionRules.map((e) => e ? waf_profile_1.WafProfileExclusionRule.toJSON(e) : undefined);
        }
        else {
            obj.exclusionRules = [];
        }
        message.coreRuleSet !== undefined &&
            (obj.coreRuleSet = message.coreRuleSet
                ? waf_profile_1.WafProfile_CoreRuleSet.toJSON(message.coreRuleSet)
                : undefined);
        message.analyzeRequestBody !== undefined &&
            (obj.analyzeRequestBody = message.analyzeRequestBody
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.toJSON(message.analyzeRequestBody)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f;
        const message = Object.assign({}, baseUpdateWafProfileRequest);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromPartial(object.updateMask)
                : undefined;
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.rules = ((_e = object.rules) === null || _e === void 0 ? void 0 : _e.map((e) => waf_profile_1.WafProfileRule.fromPartial(e))) || [];
        message.exclusionRules =
            ((_f = object.exclusionRules) === null || _f === void 0 ? void 0 : _f.map((e) => waf_profile_1.WafProfileExclusionRule.fromPartial(e))) || [];
        message.coreRuleSet =
            object.coreRuleSet !== undefined && object.coreRuleSet !== null
                ? waf_profile_1.WafProfile_CoreRuleSet.fromPartial(object.coreRuleSet)
                : undefined;
        message.analyzeRequestBody =
            object.analyzeRequestBody !== undefined && object.analyzeRequestBody !== null
                ? waf_profile_1.WafProfile_AnalyzeRequestBody.fromPartial(object.analyzeRequestBody)
                : undefined;
        return message;
    },
};
const baseUpdateWafProfileRequest_LabelsEntry = { key: '', value: '' };
exports.UpdateWafProfileRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdateWafProfileRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdateWafProfileRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpdateWafProfileRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseUpdateWafProfileMetadata = { wafProfileId: '' };
exports.UpdateWafProfileMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdateWafProfileMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdateWafProfileMetadata);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseUpdateWafProfileMetadata);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteWafProfileRequest = { wafProfileId: '' };
exports.DeleteWafProfileRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseDeleteWafProfileRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteWafProfileRequest);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteWafProfileRequest);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteWafProfileMetadata = { wafProfileId: '' };
exports.DeleteWafProfileMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.wafProfileId !== '') {
            writer.uint32(10).string(message.wafProfileId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseDeleteWafProfileMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.wafProfileId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteWafProfileMetadata);
        message.wafProfileId =
            object.wafProfileId !== undefined && object.wafProfileId !== null
                ? String(object.wafProfileId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.wafProfileId !== undefined && (obj.wafProfileId = message.wafProfileId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteWafProfileMetadata);
        message.wafProfileId = (_a = object.wafProfileId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
/** A set of methods for managing WafProfile resources. */
exports.WafProfileServiceService = {
    /** Returns the specified WafProfile resource. */
    get: {
        path: '/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetWafProfileRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetWafProfileRequest.decode(value),
        responseSerialize: (value) => Buffer.from(waf_profile_1.WafProfile.encode(value).finish()),
        responseDeserialize: (value) => waf_profile_1.WafProfile.decode(value),
    },
    /** Retrieves the list of WafProfile resources in the specified folder. */
    list: {
        path: '/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListWafProfilesRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListWafProfilesRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListWafProfilesResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListWafProfilesResponse.decode(value),
    },
    /** Creates a WAF profile in the specified folder using the data specified in the request. */
    create: {
        path: '/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreateWafProfileRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreateWafProfileRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Updates the specified WAF profile. */
    update: {
        path: '/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdateWafProfileRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdateWafProfileRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Deletes the specified WAF profile. */
    delete: {
        path: '/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeleteWafProfileRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeleteWafProfileRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
};
exports.WafProfileServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.WafProfileServiceService, 'yandex.cloud.smartwebsecurity.v1.waf.WafProfileService');
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
