"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.8
//   protoc               v4.25.9
// source: io/restorecommerce/policy.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.protoMetadata = exports.PolicyServiceDefinition = exports.PolicyResponse = exports.PolicyListResponse = exports.PolicyList = exports.PolicyRQ = exports.Policy = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const auth_1 = require("./auth");
const meta_1 = require("./meta");
const options_1 = require("./options");
const resource_base_1 = require("./resource_base");
const rule_1 = require("./rule");
const status_1 = require("./status");
exports.protobufPackage = "io.restorecommerce.policy";
function createBasePolicy() {
    return {};
}
exports.Policy = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.meta !== undefined) {
            meta_1.Meta.encode(message.meta, writer.uint32(18).fork()).join();
        }
        if (message.name !== undefined) {
            writer.uint32(26).string(message.name);
        }
        if (message.description !== undefined) {
            writer.uint32(34).string(message.description);
        }
        if (message.rules !== undefined && message.rules.length !== 0) {
            for (const v of message.rules) {
                writer.uint32(42).string(v);
            }
        }
        if (message.target !== undefined) {
            rule_1.Target.encode(message.target, writer.uint32(50).fork()).join();
        }
        if (message.effect !== undefined) {
            writer.uint32(56).int32((0, rule_1.effectToNumber)(message.effect));
        }
        if (message.combining_algorithm !== undefined) {
            writer.uint32(66).string(message.combining_algorithm);
        }
        if (message.evaluation_cacheable !== undefined) {
            writer.uint32(72).bool(message.evaluation_cacheable);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePolicy();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.meta = meta_1.Meta.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.name = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.description = reader.string();
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    if (message.rules === undefined) {
                        message.rules = [];
                    }
                    const el = reader.string();
                    if (el !== undefined) {
                        message.rules.push(el);
                    }
                    continue;
                }
                case 6: {
                    if (tag !== 50) {
                        break;
                    }
                    message.target = rule_1.Target.decode(reader, reader.uint32());
                    continue;
                }
                case 7: {
                    if (tag !== 56) {
                        break;
                    }
                    message.effect = (0, rule_1.effectFromJSON)(reader.int32());
                    continue;
                }
                case 8: {
                    if (tag !== 66) {
                        break;
                    }
                    message.combining_algorithm = reader.string();
                    continue;
                }
                case 9: {
                    if (tag !== 72) {
                        break;
                    }
                    message.evaluation_cacheable = reader.bool();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : undefined,
            meta: isSet(object.meta) ? meta_1.Meta.fromJSON(object.meta) : undefined,
            name: isSet(object.name) ? globalThis.String(object.name) : undefined,
            description: isSet(object.description) ? globalThis.String(object.description) : undefined,
            rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => globalThis.String(e)) : undefined,
            target: isSet(object.target) ? rule_1.Target.fromJSON(object.target) : undefined,
            effect: isSet(object.effect) ? (0, rule_1.effectFromJSON)(object.effect) : undefined,
            combining_algorithm: isSet(object.combiningAlgorithm)
                ? globalThis.String(object.combiningAlgorithm)
                : isSet(object.combining_algorithm)
                    ? globalThis.String(object.combining_algorithm)
                    : undefined,
            evaluation_cacheable: isSet(object.evaluationCacheable)
                ? globalThis.Boolean(object.evaluationCacheable)
                : isSet(object.evaluation_cacheable)
                    ? globalThis.Boolean(object.evaluation_cacheable)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.meta !== undefined) {
            obj.meta = meta_1.Meta.toJSON(message.meta);
        }
        if (message.name !== undefined) {
            obj.name = message.name;
        }
        if (message.description !== undefined) {
            obj.description = message.description;
        }
        if (message.rules?.length) {
            obj.rules = message.rules;
        }
        if (message.target !== undefined) {
            obj.target = rule_1.Target.toJSON(message.target);
        }
        if (message.effect !== undefined) {
            obj.effect = (0, rule_1.effectToJSON)(message.effect);
        }
        if (message.combining_algorithm !== undefined) {
            obj.combiningAlgorithm = message.combining_algorithm;
        }
        if (message.evaluation_cacheable !== undefined) {
            obj.evaluationCacheable = message.evaluation_cacheable;
        }
        return obj;
    },
    create(base) {
        return exports.Policy.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePolicy();
        message.id = object.id ?? undefined;
        message.meta = (object.meta !== undefined && object.meta !== null) ? meta_1.Meta.fromPartial(object.meta) : undefined;
        message.name = object.name ?? undefined;
        message.description = object.description ?? undefined;
        message.rules = object.rules?.map((e) => e) || undefined;
        message.target = (object.target !== undefined && object.target !== null)
            ? rule_1.Target.fromPartial(object.target)
            : undefined;
        message.effect = object.effect ?? undefined;
        message.combining_algorithm = object.combining_algorithm ?? undefined;
        message.evaluation_cacheable = object.evaluation_cacheable ?? undefined;
        return message;
    },
};
function createBasePolicyRQ() {
    return {};
}
exports.PolicyRQ = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.target !== undefined) {
            rule_1.Target.encode(message.target, writer.uint32(18).fork()).join();
        }
        if (message.combining_algorithm !== undefined) {
            writer.uint32(26).string(message.combining_algorithm);
        }
        if (message.rules !== undefined && message.rules.length !== 0) {
            for (const v of message.rules) {
                rule_1.RuleRQ.encode(v, writer.uint32(34).fork()).join();
            }
        }
        if (message.effect !== undefined) {
            writer.uint32(40).int32((0, rule_1.effectToNumber)(message.effect));
        }
        if (message.has_rules !== undefined) {
            writer.uint32(48).bool(message.has_rules);
        }
        if (message.evaluation_cacheable !== undefined) {
            writer.uint32(56).bool(message.evaluation_cacheable);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePolicyRQ();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.target = rule_1.Target.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.combining_algorithm = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    if (message.rules === undefined) {
                        message.rules = [];
                    }
                    const el = rule_1.RuleRQ.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.rules.push(el);
                    }
                    continue;
                }
                case 5: {
                    if (tag !== 40) {
                        break;
                    }
                    message.effect = (0, rule_1.effectFromJSON)(reader.int32());
                    continue;
                }
                case 6: {
                    if (tag !== 48) {
                        break;
                    }
                    message.has_rules = reader.bool();
                    continue;
                }
                case 7: {
                    if (tag !== 56) {
                        break;
                    }
                    message.evaluation_cacheable = reader.bool();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : undefined,
            target: isSet(object.target) ? rule_1.Target.fromJSON(object.target) : undefined,
            combining_algorithm: isSet(object.combiningAlgorithm)
                ? globalThis.String(object.combiningAlgorithm)
                : isSet(object.combining_algorithm)
                    ? globalThis.String(object.combining_algorithm)
                    : undefined,
            rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => rule_1.RuleRQ.fromJSON(e)) : undefined,
            effect: isSet(object.effect) ? (0, rule_1.effectFromJSON)(object.effect) : undefined,
            has_rules: isSet(object.hasRules)
                ? globalThis.Boolean(object.hasRules)
                : isSet(object.has_rules)
                    ? globalThis.Boolean(object.has_rules)
                    : undefined,
            evaluation_cacheable: isSet(object.evaluationCacheable)
                ? globalThis.Boolean(object.evaluationCacheable)
                : isSet(object.evaluation_cacheable)
                    ? globalThis.Boolean(object.evaluation_cacheable)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.target !== undefined) {
            obj.target = rule_1.Target.toJSON(message.target);
        }
        if (message.combining_algorithm !== undefined) {
            obj.combiningAlgorithm = message.combining_algorithm;
        }
        if (message.rules?.length) {
            obj.rules = message.rules.map((e) => rule_1.RuleRQ.toJSON(e));
        }
        if (message.effect !== undefined) {
            obj.effect = (0, rule_1.effectToJSON)(message.effect);
        }
        if (message.has_rules !== undefined) {
            obj.hasRules = message.has_rules;
        }
        if (message.evaluation_cacheable !== undefined) {
            obj.evaluationCacheable = message.evaluation_cacheable;
        }
        return obj;
    },
    create(base) {
        return exports.PolicyRQ.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePolicyRQ();
        message.id = object.id ?? undefined;
        message.target = (object.target !== undefined && object.target !== null)
            ? rule_1.Target.fromPartial(object.target)
            : undefined;
        message.combining_algorithm = object.combining_algorithm ?? undefined;
        message.rules = object.rules?.map((e) => rule_1.RuleRQ.fromPartial(e)) || undefined;
        message.effect = object.effect ?? undefined;
        message.has_rules = object.has_rules ?? undefined;
        message.evaluation_cacheable = object.evaluation_cacheable ?? undefined;
        return message;
    },
};
function createBasePolicyList() {
    return {};
}
exports.PolicyList = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.Policy.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.total_count !== undefined) {
            writer.uint32(16).uint32(message.total_count);
        }
        if (message.subject !== undefined) {
            auth_1.Subject.encode(message.subject, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePolicyList();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.Policy.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.total_count = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.subject = auth_1.Subject.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => exports.Policy.fromJSON(e)) : undefined,
            total_count: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
            subject: isSet(object.subject) ? auth_1.Subject.fromJSON(object.subject) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.Policy.toJSON(e));
        }
        if (message.total_count !== undefined) {
            obj.totalCount = Math.round(message.total_count);
        }
        if (message.subject !== undefined) {
            obj.subject = auth_1.Subject.toJSON(message.subject);
        }
        return obj;
    },
    create(base) {
        return exports.PolicyList.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePolicyList();
        message.items = object.items?.map((e) => exports.Policy.fromPartial(e)) || undefined;
        message.total_count = object.total_count ?? undefined;
        message.subject = (object.subject !== undefined && object.subject !== null)
            ? auth_1.Subject.fromPartial(object.subject)
            : undefined;
        return message;
    },
};
function createBasePolicyListResponse() {
    return {};
}
exports.PolicyListResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.PolicyResponse.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.total_count !== undefined) {
            writer.uint32(16).uint32(message.total_count);
        }
        if (message.operation_status !== undefined) {
            status_1.OperationStatus.encode(message.operation_status, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePolicyListResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.PolicyResponse.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.total_count = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.operation_status = status_1.OperationStatus.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items)
                ? object.items.map((e) => exports.PolicyResponse.fromJSON(e))
                : undefined,
            total_count: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
            operation_status: isSet(object.operationStatus)
                ? status_1.OperationStatus.fromJSON(object.operationStatus)
                : isSet(object.operation_status)
                    ? status_1.OperationStatus.fromJSON(object.operation_status)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.PolicyResponse.toJSON(e));
        }
        if (message.total_count !== undefined) {
            obj.totalCount = Math.round(message.total_count);
        }
        if (message.operation_status !== undefined) {
            obj.operationStatus = status_1.OperationStatus.toJSON(message.operation_status);
        }
        return obj;
    },
    create(base) {
        return exports.PolicyListResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePolicyListResponse();
        message.items = object.items?.map((e) => exports.PolicyResponse.fromPartial(e)) || undefined;
        message.total_count = object.total_count ?? undefined;
        message.operation_status = (object.operation_status !== undefined && object.operation_status !== null)
            ? status_1.OperationStatus.fromPartial(object.operation_status)
            : undefined;
        return message;
    },
};
function createBasePolicyResponse() {
    return {};
}
exports.PolicyResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.payload !== undefined) {
            exports.Policy.encode(message.payload, writer.uint32(10).fork()).join();
        }
        if (message.status !== undefined) {
            status_1.Status.encode(message.status, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePolicyResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.payload = exports.Policy.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.status = status_1.Status.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            payload: isSet(object.payload) ? exports.Policy.fromJSON(object.payload) : undefined,
            status: isSet(object.status) ? status_1.Status.fromJSON(object.status) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.payload !== undefined) {
            obj.payload = exports.Policy.toJSON(message.payload);
        }
        if (message.status !== undefined) {
            obj.status = status_1.Status.toJSON(message.status);
        }
        return obj;
    },
    create(base) {
        return exports.PolicyResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePolicyResponse();
        message.payload = (object.payload !== undefined && object.payload !== null)
            ? exports.Policy.fromPartial(object.payload)
            : undefined;
        message.status = (object.status !== undefined && object.status !== null)
            ? status_1.Status.fromPartial(object.status)
            : undefined;
        return message;
    },
};
exports.PolicyServiceDefinition = {
    name: "PolicyService",
    fullName: "io.restorecommerce.policy.PolicyService",
    methods: {
        read: {
            name: "Read",
            requestType: resource_base_1.ReadRequest,
            requestStream: false,
            responseType: exports.PolicyListResponse,
            responseStream: false,
            options: { _unknownFields: { 248008: [Buffer.from([1])] } },
        },
        create: {
            name: "Create",
            requestType: exports.PolicyList,
            requestStream: false,
            responseType: exports.PolicyListResponse,
            responseStream: false,
            options: {},
        },
        delete: {
            name: "Delete",
            requestType: resource_base_1.DeleteRequest,
            requestStream: false,
            responseType: resource_base_1.DeleteResponse,
            responseStream: false,
            options: {},
        },
        update: {
            name: "Update",
            requestType: exports.PolicyList,
            requestStream: false,
            responseType: exports.PolicyListResponse,
            responseStream: false,
            options: {},
        },
        upsert: {
            name: "Upsert",
            requestType: exports.PolicyList,
            requestStream: false,
            responseType: exports.PolicyListResponse,
            responseStream: false,
            options: {},
        },
    },
};
exports.protoMetadata = {
    fileDescriptor: {
        "name": "io/restorecommerce/policy.proto",
        "package": "io.restorecommerce.policy",
        "dependency": [
            "io/restorecommerce/resource_base.proto",
            "io/restorecommerce/meta.proto",
            "io/restorecommerce/rule.proto",
            "io/restorecommerce/auth.proto",
            "io/restorecommerce/status.proto",
            "io/restorecommerce/options.proto",
        ],
        "publicDependency": [],
        "weakDependency": [],
        "optionDependency": [],
        "messageType": [{
                "name": "Policy",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "meta",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.meta.Meta",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "meta",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "name",
                        "number": 3,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "name",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "description",
                        "number": 4,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 3,
                        "jsonName": "description",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "rules",
                        "number": 5,
                        "label": 3,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "rules",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "target",
                        "number": 6,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.rule.Target",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 4,
                        "jsonName": "target",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "effect",
                        "number": 7,
                        "label": 1,
                        "type": 14,
                        "typeName": ".io.restorecommerce.rule.Effect",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 5,
                        "jsonName": "effect",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "combining_algorithm",
                        "number": 8,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 6,
                        "jsonName": "combiningAlgorithm",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "evaluation_cacheable",
                        "number": 9,
                        "label": 1,
                        "type": 8,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 7,
                        "jsonName": "evaluationCacheable",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [
                    { "name": "_id", "options": undefined },
                    { "name": "_meta", "options": undefined },
                    { "name": "_name", "options": undefined },
                    { "name": "_description", "options": undefined },
                    { "name": "_target", "options": undefined },
                    { "name": "_effect", "options": undefined },
                    { "name": "_combining_algorithm", "options": undefined },
                    { "name": "_evaluation_cacheable", "options": undefined },
                ],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "PolicyRQ",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "target",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.rule.Target",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "target",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "combining_algorithm",
                        "number": 3,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "combiningAlgorithm",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "rules",
                        "number": 4,
                        "label": 3,
                        "type": 11,
                        "typeName": ".io.restorecommerce.rule.RuleRQ",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "rules",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "effect",
                        "number": 5,
                        "label": 1,
                        "type": 14,
                        "typeName": ".io.restorecommerce.rule.Effect",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 3,
                        "jsonName": "effect",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "has_rules",
                        "number": 6,
                        "label": 1,
                        "type": 8,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 4,
                        "jsonName": "hasRules",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "evaluation_cacheable",
                        "number": 7,
                        "label": 1,
                        "type": 8,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 5,
                        "jsonName": "evaluationCacheable",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [
                    { "name": "_id", "options": undefined },
                    { "name": "_target", "options": undefined },
                    { "name": "_combining_algorithm", "options": undefined },
                    { "name": "_effect", "options": undefined },
                    { "name": "_has_rules", "options": undefined },
                    { "name": "_evaluation_cacheable", "options": undefined },
                ],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "PolicyList",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".io.restorecommerce.policy.Policy",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "subject",
                        "number": 3,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.auth.Subject",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "subject",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }, { "name": "_subject", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "PolicyListResponse",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".io.restorecommerce.policy.PolicyResponse",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "operation_status",
                        "number": 3,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.OperationStatus",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "operationStatus",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }, {
                        "name": "_operation_status",
                        "options": undefined,
                    }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "PolicyResponse",
                "field": [{
                        "name": "payload",
                        "number": 1,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.policy.Policy",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "payload",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "status",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.Status",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_payload", "options": undefined }, { "name": "_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }],
        "enumType": [],
        "service": [{
                "name": "PolicyService",
                "method": [{
                        "name": "Read",
                        "inputType": ".io.restorecommerce.resourcebase.ReadRequest",
                        "outputType": ".io.restorecommerce.policy.PolicyListResponse",
                        "options": { "deprecated": false, "idempotencyLevel": 0, "features": undefined, "uninterpretedOption": [] },
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Create",
                        "inputType": ".io.restorecommerce.policy.PolicyList",
                        "outputType": ".io.restorecommerce.policy.PolicyListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Delete",
                        "inputType": ".io.restorecommerce.resourcebase.DeleteRequest",
                        "outputType": ".io.restorecommerce.resourcebase.DeleteResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Update",
                        "inputType": ".io.restorecommerce.policy.PolicyList",
                        "outputType": ".io.restorecommerce.policy.PolicyListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Upsert",
                        "inputType": ".io.restorecommerce.policy.PolicyList",
                        "outputType": ".io.restorecommerce.policy.PolicyListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }],
                "options": undefined,
            }],
        "extension": [],
        "options": undefined,
        "sourceCodeInfo": {
            "location": [{
                    "path": [4, 0],
                    "span": [14, 0, 24, 1],
                    "leadingComments": "*\n A Policy is defined by a set of Rules.\n",
                    "trailingComments": "",
                    "leadingDetachedComments": [],
                }, {
                    "path": [4, 0, 2, 4],
                    "span": [19, 2, 28],
                    "leadingComments": "",
                    "trailingComments": " rule IDs\n",
                    "leadingDetachedComments": [],
                }, {
                    "path": [4, 0, 2, 5],
                    "span": [20, 2, 53],
                    "leadingComments": "",
                    "trailingComments": " general policy target\n",
                    "leadingDetachedComments": [],
                }],
        },
        "syntax": "proto3",
        "edition": 0,
    },
    references: {
        ".io.restorecommerce.policy.Policy": exports.Policy,
        ".io.restorecommerce.policy.PolicyRQ": exports.PolicyRQ,
        ".io.restorecommerce.policy.PolicyList": exports.PolicyList,
        ".io.restorecommerce.policy.PolicyListResponse": exports.PolicyListResponse,
        ".io.restorecommerce.policy.PolicyResponse": exports.PolicyResponse,
    },
    dependencies: [resource_base_1.protoMetadata, meta_1.protoMetadata, rule_1.protoMetadata, auth_1.protoMetadata, status_1.protoMetadata, options_1.protoMetadata],
    options: { services: { "PolicyService": { methods: { "Read": { "is_query": true } } } } },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=policy.js.map