"use strict";
/* eslint-disable-next-line no-unused-vars */
function __export(m) {
/* eslint-disable-next-line no-prototype-builtins */
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable-next-line no-unused-vars */
var jtv = require('@mojotech/json-type-validation');
/* eslint-disable-next-line no-unused-vars */
var damlTypes = require('@daml/types');
/* eslint-disable-next-line no-unused-vars */
var damlLedger = require('@daml/ledger');

var pkg3ca1343ab26b453d38c8adb70dca5f1ead8440c42b59b68f070786955cbf9ec1 = require('../../..');
var pkg5aee9b21b8e9a4c4975b5f4c4198e6e6e8469df49e2010820e792f393db870f4 = require('../../../DA/Types');
var pkg9e70a8b3510d617f8a136213f33d6a903a10ca0eeec76bb06ba55d1ed9680f69 = require('../../../DA/Internal/Template');

var CantonPayments_PaymentStream_ActivePaymentStream = require('../../../CantonPayments/PaymentStream/ActivePaymentStream/module');
var CantonPayments_PaymentStream_ProposedPaymentStream = require('../../../CantonPayments/PaymentStream/ProposedPaymentStream/module');
var CantonPayments_PaymentStream_Types_LockFundsInput = require('../../../CantonPayments/PaymentStream/Types/LockFundsInput/module');
var CantonPayments_PaymentStream_Types_PaymentStreamProposal = require('../../../CantonPayments/PaymentStream/Types/PaymentStreamProposal/module');
var CantonPayments_PaymentStream_Types_ProcessorContext = require('../../../CantonPayments/PaymentStream/Types/ProcessorContext/module');


exports.PaymentStreamFactory_CreatePaymentStreamProposal = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({actor: damlTypes.Party.decoder, paymentStreamProposal: CantonPayments_PaymentStream_Types_PaymentStreamProposal.PaymentStreamProposal.decoder, lockFundsInput: jtv.Decoder.withDefault(null, damlTypes.Optional(CantonPayments_PaymentStream_Types_LockFundsInput.LockFundsInput).decoder), }); }),
  encode: function (__typed__) {
  return {
    actor: damlTypes.Party.encode(__typed__.actor),
    paymentStreamProposal: CantonPayments_PaymentStream_Types_PaymentStreamProposal.PaymentStreamProposal.encode(__typed__.paymentStreamProposal),
    lockFundsInput: damlTypes.Optional(CantonPayments_PaymentStream_Types_LockFundsInput.LockFundsInput).encode(__typed__.lockFundsInput),
  };
}
,
};



exports.PaymentStreamFactory = damlTypes.assembleTemplate(
{
  templateId: '#CantonPayments:CantonPayments.PaymentStream.PaymentStreamFactory:PaymentStreamFactory',
  keyDecoder: damlTypes.lazyMemo(function () { return jtv.constant(undefined); }),
  keyEncode: function () { throw 'EncodeError'; },
  decoder: damlTypes.lazyMemo(function () { return jtv.object({processorContext: CantonPayments_PaymentStream_Types_ProcessorContext.ProcessorContext.decoder, }); }),
  encode: function (__typed__) {
  return {
    processorContext: CantonPayments_PaymentStream_Types_ProcessorContext.ProcessorContext.encode(__typed__.processorContext),
  };
}
,
  Archive: {
    template: function () { return exports.PaymentStreamFactory; },
    choiceName: 'Archive',
    argumentDecoder: damlTypes.lazyMemo(function () { return pkg9e70a8b3510d617f8a136213f33d6a903a10ca0eeec76bb06ba55d1ed9680f69.DA.Internal.Template.Archive.decoder; }),
    argumentEncode: function (__typed__) { return pkg9e70a8b3510d617f8a136213f33d6a903a10ca0eeec76bb06ba55d1ed9680f69.DA.Internal.Template.Archive.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return damlTypes.Unit.decoder; }),
    resultEncode: function (__typed__) { return damlTypes.Unit.encode(__typed__); },
  },
  PaymentStreamFactory_CreatePaymentStreamProposal: {
    template: function () { return exports.PaymentStreamFactory; },
    choiceName: 'PaymentStreamFactory_CreatePaymentStreamProposal',
    argumentDecoder: damlTypes.lazyMemo(function () { return exports.PaymentStreamFactory_CreatePaymentStreamProposal.decoder; }),
    argumentEncode: function (__typed__) { return exports.PaymentStreamFactory_CreatePaymentStreamProposal.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return pkg5aee9b21b8e9a4c4975b5f4c4198e6e6e8469df49e2010820e792f393db870f4.DA.Types.Either(damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream), pkg5aee9b21b8e9a4c4975b5f4c4198e6e6e8469df49e2010820e792f393db870f4.DA.Types.Tuple2(damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream), damlTypes.Optional(damlTypes.ContractId(pkg3ca1343ab26b453d38c8adb70dca5f1ead8440c42b59b68f070786955cbf9ec1.Amulet)))).decoder; }),
    resultEncode: function (__typed__) { return pkg5aee9b21b8e9a4c4975b5f4c4198e6e6e8469df49e2010820e792f393db870f4.DA.Types.Either(damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream), pkg5aee9b21b8e9a4c4975b5f4c4198e6e6e8469df49e2010820e792f393db870f4.DA.Types.Tuple2(damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream), damlTypes.Optional(damlTypes.ContractId(pkg3ca1343ab26b453d38c8adb70dca5f1ead8440c42b59b68f070786955cbf9ec1.Amulet)))).encode(__typed__); },
  },
}

);


damlTypes.registerTemplate(exports.PaymentStreamFactory, ['ba78a0a88becb5fcf5ad1f848cc261818212de5f52c4e7fb467a27a090f445cd', '#CantonPayments']);

