"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 pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f = require('../MetadataV1');
var pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b = require('../HoldingV1');
var pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d = require('../AllocationV1');
var pkg9e70a8b3510d617f8a136213f33d6a903a10ca0eeec76bb06ba55d1ed9680f69 = require('../../../../DA/Internal/Template');

exports.AllocationFactory = damlTypes.assembleInterface(
  '275064aacfe99cea72ee0c80563936129563776f67415ef9f13e4297eecbc520:Splice.Api.Token.AllocationInstructionV1:AllocationFactory',
  function () { return exports.AllocationFactoryView; },
  {
    Archive: {
      template: function () { return exports.AllocationFactory; },
      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__); },
    },
    AllocationFactory_Allocate: {
      template: function () { return exports.AllocationFactory; },
      choiceName: 'AllocationFactory_Allocate',
      argumentDecoder: damlTypes.lazyMemo(function () { return exports.AllocationFactory_Allocate.decoder; }),
      argumentEncode: function (__typed__) { return exports.AllocationFactory_Allocate.encode(__typed__); },
      resultDecoder: damlTypes.lazyMemo(function () { return exports.AllocationInstructionResult.decoder; }),
      resultEncode: function (__typed__) { return exports.AllocationInstructionResult.encode(__typed__); },
    },
    AllocationFactory_PublicFetch: {
      template: function () { return exports.AllocationFactory; },
      choiceName: 'AllocationFactory_PublicFetch',
      argumentDecoder: damlTypes.lazyMemo(function () { return exports.AllocationFactory_PublicFetch.decoder; }),
      argumentEncode: function (__typed__) { return exports.AllocationFactory_PublicFetch.encode(__typed__); },
      resultDecoder: damlTypes.lazyMemo(function () { return exports.AllocationFactoryView.decoder; }),
      resultEncode: function (__typed__) { return exports.AllocationFactoryView.encode(__typed__); },
    },
  });


exports.AllocationInstruction = damlTypes.assembleInterface(
  '275064aacfe99cea72ee0c80563936129563776f67415ef9f13e4297eecbc520:Splice.Api.Token.AllocationInstructionV1:AllocationInstruction',
  function () { return exports.AllocationInstructionView; },
  {
    Archive: {
      template: function () { return exports.AllocationInstruction; },
      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__); },
    },
    AllocationInstruction_Withdraw: {
      template: function () { return exports.AllocationInstruction; },
      choiceName: 'AllocationInstruction_Withdraw',
      argumentDecoder: damlTypes.lazyMemo(function () { return exports.AllocationInstruction_Withdraw.decoder; }),
      argumentEncode: function (__typed__) { return exports.AllocationInstruction_Withdraw.encode(__typed__); },
      resultDecoder: damlTypes.lazyMemo(function () { return exports.AllocationInstructionResult.decoder; }),
      resultEncode: function (__typed__) { return exports.AllocationInstructionResult.encode(__typed__); },
    },
    AllocationInstruction_Update: {
      template: function () { return exports.AllocationInstruction; },
      choiceName: 'AllocationInstruction_Update',
      argumentDecoder: damlTypes.lazyMemo(function () { return exports.AllocationInstruction_Update.decoder; }),
      argumentEncode: function (__typed__) { return exports.AllocationInstruction_Update.encode(__typed__); },
      resultDecoder: damlTypes.lazyMemo(function () { return exports.AllocationInstructionResult.decoder; }),
      resultEncode: function (__typed__) { return exports.AllocationInstructionResult.encode(__typed__); },
    },
  });



exports.AllocationInstructionResult_Output = {
  decoder: damlTypes.lazyMemo(function () { return jtv.oneOf(jtv.object({tag: jtv.constant('AllocationInstructionResult_Pending'), value: exports.AllocationInstructionResult_Output.AllocationInstructionResult_Pending.decoder, }), jtv.object({tag: jtv.constant('AllocationInstructionResult_Completed'), value: exports.AllocationInstructionResult_Output.AllocationInstructionResult_Completed.decoder, }), jtv.object({tag: jtv.constant('AllocationInstructionResult_Failed'), value: damlTypes.Unit.decoder, })); }),
  encode: function (__typed__) {
  switch(__typed__.tag) {
    case 'AllocationInstructionResult_Pending': return {tag: __typed__.tag, value: exports.AllocationInstructionResult_Output.AllocationInstructionResult_Pending.encode(__typed__.value)};
    case 'AllocationInstructionResult_Completed': return {tag: __typed__.tag, value: exports.AllocationInstructionResult_Output.AllocationInstructionResult_Completed.encode(__typed__.value)};
    case 'AllocationInstructionResult_Failed': return {tag: __typed__.tag, value: damlTypes.Unit.encode(__typed__.value)};
    default: throw 'unrecognized type tag: ' + __typed__.tag + ' while serializing a value of type AllocationInstructionResult_Output';
  }
}
,
  AllocationInstructionResult_Pending:({
    decoder: damlTypes.lazyMemo(function () { return jtv.object({allocationInstructionCid: damlTypes.ContractId(exports.AllocationInstruction).decoder, }); }),
    encode: function (__typed__) {
  return {
    allocationInstructionCid: damlTypes.ContractId(exports.AllocationInstruction).encode(__typed__.allocationInstructionCid),
  };
}
,
  }),
  AllocationInstructionResult_Completed:({
    decoder: damlTypes.lazyMemo(function () { return jtv.object({allocationCid: damlTypes.ContractId(pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.Allocation).decoder, }); }),
    encode: function (__typed__) {
  return {
    allocationCid: damlTypes.ContractId(pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.Allocation).encode(__typed__.allocationCid),
  };
}
,
  }),
};







exports.AllocationInstructionResult = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({output: exports.AllocationInstructionResult_Output.decoder, senderChangeCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).decoder, meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.decoder, }); }),
  encode: function (__typed__) {
  return {
    output: exports.AllocationInstructionResult_Output.encode(__typed__.output),
    senderChangeCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).encode(__typed__.senderChangeCids),
    meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.encode(__typed__.meta),
  };
}
,
};



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



exports.AllocationFactory_Allocate = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({expectedAdmin: damlTypes.Party.decoder, allocation: pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.AllocationSpecification.decoder, requestedAt: damlTypes.Time.decoder, inputHoldingCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).decoder, extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.decoder, }); }),
  encode: function (__typed__) {
  return {
    expectedAdmin: damlTypes.Party.encode(__typed__.expectedAdmin),
    allocation: pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.AllocationSpecification.encode(__typed__.allocation),
    requestedAt: damlTypes.Time.encode(__typed__.requestedAt),
    inputHoldingCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).encode(__typed__.inputHoldingCids),
    extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.encode(__typed__.extraArgs),
  };
}
,
};



exports.AllocationFactoryView = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({admin: damlTypes.Party.decoder, meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.decoder, }); }),
  encode: function (__typed__) {
  return {
    admin: damlTypes.Party.encode(__typed__.admin),
    meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.encode(__typed__.meta),
  };
}
,
};



exports.AllocationInstruction_Update = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({extraActors: damlTypes.List(damlTypes.Party).decoder, extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.decoder, }); }),
  encode: function (__typed__) {
  return {
    extraActors: damlTypes.List(damlTypes.Party).encode(__typed__.extraActors),
    extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.encode(__typed__.extraArgs),
  };
}
,
};



exports.AllocationInstruction_Withdraw = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.decoder, }); }),
  encode: function (__typed__) {
  return {
    extraArgs: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.ExtraArgs.encode(__typed__.extraArgs),
  };
}
,
};



exports.AllocationInstructionView = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({originalInstructionCid: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.ContractId(exports.AllocationInstruction)).decoder), allocation: pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.AllocationSpecification.decoder, pendingActions: damlTypes.Map(damlTypes.Party, damlTypes.Text).decoder, requestedAt: damlTypes.Time.decoder, inputHoldingCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).decoder, meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.decoder, }); }),
  encode: function (__typed__) {
  return {
    originalInstructionCid: damlTypes.Optional(damlTypes.ContractId(exports.AllocationInstruction)).encode(__typed__.originalInstructionCid),
    allocation: pkg93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d.AllocationSpecification.encode(__typed__.allocation),
    pendingActions: damlTypes.Map(damlTypes.Party, damlTypes.Text).encode(__typed__.pendingActions),
    requestedAt: damlTypes.Time.encode(__typed__.requestedAt),
    inputHoldingCids: damlTypes.List(damlTypes.ContractId(pkg718a0f77e505a8de22f188bd4c87fe74101274e9d4cb1bfac7d09aec7158d35b.Holding)).encode(__typed__.inputHoldingCids),
    meta: pkg4ded6b668cb3b64f7a88a30874cd41c75829f5e064b3fbbadf41ec7e8363354f.Metadata.encode(__typed__.meta),
  };
}
,
};

