"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.7.0
//   protoc               v6.30.2
// source: rekor/v2/dsse.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.DSSELogEntryV002 = exports.DSSERequestV002 = void 0;
/* eslint-disable */
const envelope_1 = require("../../envelope");
const sigstore_common_1 = require("../../sigstore_common");
const verifier_1 = require("./verifier");
exports.DSSERequestV002 = {
    fromJSON(object) {
        return {
            envelope: isSet(object.envelope) ? envelope_1.Envelope.fromJSON(object.envelope) : undefined,
            verifiers: globalThis.Array.isArray(object?.verifiers)
                ? object.verifiers.map((e) => verifier_1.Verifier.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.envelope !== undefined) {
            obj.envelope = envelope_1.Envelope.toJSON(message.envelope);
        }
        if (message.verifiers?.length) {
            obj.verifiers = message.verifiers.map((e) => verifier_1.Verifier.toJSON(e));
        }
        return obj;
    },
};
exports.DSSELogEntryV002 = {
    fromJSON(object) {
        return {
            payloadHash: isSet(object.payloadHash) ? sigstore_common_1.HashOutput.fromJSON(object.payloadHash) : undefined,
            signatures: globalThis.Array.isArray(object?.signatures)
                ? object.signatures.map((e) => verifier_1.Signature.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.payloadHash !== undefined) {
            obj.payloadHash = sigstore_common_1.HashOutput.toJSON(message.payloadHash);
        }
        if (message.signatures?.length) {
            obj.signatures = message.signatures.map((e) => verifier_1.Signature.toJSON(e));
        }
        return obj;
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
