"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');

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_PartyRole = require('../../../CantonPayments/PaymentStream/Types/PartyRole/module');
var CantonPayments_PaymentStream_Types_PaymentContext = require('../../../CantonPayments/PaymentStream/Types/PaymentContext/module');


exports.PartyMigrationProposal_Archive = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({actor: damlTypes.Party.decoder, description: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), }); }),
  encode: function (__typed__) {
  return {
    actor: damlTypes.Party.encode(__typed__.actor),
    description: damlTypes.Optional(damlTypes.Text).encode(__typed__.description),
  };
}
,
};



exports.PartyMigrationProposal_MigrateProposedPaymentStream = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({actor: damlTypes.Party.decoder, proposedPaymentStreamCid: damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream).decoder, }); }),
  encode: function (__typed__) {
  return {
    actor: damlTypes.Party.encode(__typed__.actor),
    proposedPaymentStreamCid: damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream).encode(__typed__.proposedPaymentStreamCid),
  };
}
,
};



exports.PartyMigrationProposal_MigrateActivePaymentStream = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({actor: damlTypes.Party.decoder, activePaymentStreamCid: damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream).decoder, changePartyPaymentContext: CantonPayments_PaymentStream_Types_PaymentContext.PaymentContext.decoder, }); }),
  encode: function (__typed__) {
  return {
    actor: damlTypes.Party.encode(__typed__.actor),
    activePaymentStreamCid: damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream).encode(__typed__.activePaymentStreamCid),
    changePartyPaymentContext: CantonPayments_PaymentStream_Types_PaymentContext.PaymentContext.encode(__typed__.changePartyPaymentContext),
  };
}
,
};



exports.PartyMigrationProposal_Approve = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({actor: damlTypes.Party.decoder, }); }),
  encode: function (__typed__) {
  return {
    actor: damlTypes.Party.encode(__typed__.actor),
  };
}
,
};



exports.PartyMigrationProposal = damlTypes.assembleTemplate(
{
  templateId: '#CantonPayments:CantonPayments.PaymentStream.PartyMigrationProposal:PartyMigrationProposal',
  templateIdWithPackageId: 'b9b320d4b90b6367688d5eb6134b57c80da1bc8fe99b7b4f923f889da544947d:CantonPayments.PaymentStream.PartyMigrationProposal:PartyMigrationProposal',
  keyDecoder: damlTypes.lazyMemo(function () { return jtv.constant(undefined); }),
  keyEncode: function () { throw 'EncodeError'; },
  decoder: damlTypes.lazyMemo(function () { return jtv.object({partyType: CantonPayments_PaymentStream_Types_PartyRole.PartyRole.decoder, oldParty: damlTypes.Party.decoder, newParty: damlTypes.Party.decoder, oldPartyApproved: damlTypes.Bool.decoder, newPartyApproved: damlTypes.Bool.decoder, }); }),
  encode: function (__typed__) {
  return {
    partyType: CantonPayments_PaymentStream_Types_PartyRole.PartyRole.encode(__typed__.partyType),
    oldParty: damlTypes.Party.encode(__typed__.oldParty),
    newParty: damlTypes.Party.encode(__typed__.newParty),
    oldPartyApproved: damlTypes.Bool.encode(__typed__.oldPartyApproved),
    newPartyApproved: damlTypes.Bool.encode(__typed__.newPartyApproved),
  };
}
,
  PartyMigrationProposal_Approve: {
    template: function () { return exports.PartyMigrationProposal; },
    choiceName: 'PartyMigrationProposal_Approve',
    argumentDecoder: damlTypes.lazyMemo(function () { return exports.PartyMigrationProposal_Approve.decoder; }),
    argumentEncode: function (__typed__) { return exports.PartyMigrationProposal_Approve.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return damlTypes.ContractId(exports.PartyMigrationProposal).decoder; }),
    resultEncode: function (__typed__) { return damlTypes.ContractId(exports.PartyMigrationProposal).encode(__typed__); },
  },
  PartyMigrationProposal_MigrateActivePaymentStream: {
    template: function () { return exports.PartyMigrationProposal; },
    choiceName: 'PartyMigrationProposal_MigrateActivePaymentStream',
    argumentDecoder: damlTypes.lazyMemo(function () { return exports.PartyMigrationProposal_MigrateActivePaymentStream.decoder; }),
    argumentEncode: function (__typed__) { return exports.PartyMigrationProposal_MigrateActivePaymentStream.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream).decoder; }),
    resultEncode: function (__typed__) { return damlTypes.ContractId(CantonPayments_PaymentStream_ActivePaymentStream.ActivePaymentStream).encode(__typed__); },
  },
  PartyMigrationProposal_MigrateProposedPaymentStream: {
    template: function () { return exports.PartyMigrationProposal; },
    choiceName: 'PartyMigrationProposal_MigrateProposedPaymentStream',
    argumentDecoder: damlTypes.lazyMemo(function () { return exports.PartyMigrationProposal_MigrateProposedPaymentStream.decoder; }),
    argumentEncode: function (__typed__) { return exports.PartyMigrationProposal_MigrateProposedPaymentStream.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream).decoder; }),
    resultEncode: function (__typed__) { return damlTypes.ContractId(CantonPayments_PaymentStream_ProposedPaymentStream.ProposedPaymentStream).encode(__typed__); },
  },
  PartyMigrationProposal_Archive: {
    template: function () { return exports.PartyMigrationProposal; },
    choiceName: 'PartyMigrationProposal_Archive',
    argumentDecoder: damlTypes.lazyMemo(function () { return exports.PartyMigrationProposal_Archive.decoder; }),
    argumentEncode: function (__typed__) { return exports.PartyMigrationProposal_Archive.encode(__typed__); },
    resultDecoder: damlTypes.lazyMemo(function () { return damlTypes.Unit.decoder; }),
    resultEncode: function (__typed__) { return damlTypes.Unit.encode(__typed__); },
  },
  Archive: {
    template: function () { return exports.PartyMigrationProposal; },
    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__); },
  },
}

);


damlTypes.registerTemplate(exports.PartyMigrationProposal, ['b9b320d4b90b6367688d5eb6134b57c80da1bc8fe99b7b4f923f889da544947d', '#CantonPayments']);

