"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 pkg9e70a8b3510d617f8a136213f33d6a903a10ca0eeec76bb06ba55d1ed9680f69 = require('../../../../DA/Internal/Template');

var Fairmint_OpenCapTable_Types = require('../../../../Fairmint/OpenCapTable/Types/module');


exports.OcfStockIssuanceType = {
  OcfStockIssuanceRSA: 'OcfStockIssuanceRSA',
  OcfStockIssuanceFounders: 'OcfStockIssuanceFounders',
  keys: ['OcfStockIssuanceRSA','OcfStockIssuanceFounders',],
  decoder: damlTypes.lazyMemo(function () { return jtv.oneOf(jtv.constant(exports.OcfStockIssuanceType.OcfStockIssuanceRSA), jtv.constant(exports.OcfStockIssuanceType.OcfStockIssuanceFounders)); }),
  encode: function (__typed__) { return __typed__; },
};



exports.StockIssuanceOcfData = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({id: damlTypes.Text.decoder, custom_id: damlTypes.Text.decoder, date: damlTypes.Time.decoder, quantity: damlTypes.Numeric(10).decoder, security_id: damlTypes.Text.decoder, share_price: Fairmint_OpenCapTable_Types.OcfMonetary.decoder, stakeholder_id: damlTypes.Text.decoder, stock_class_id: damlTypes.Text.decoder, comments: damlTypes.List(damlTypes.Text).decoder, security_law_exemptions: damlTypes.List(Fairmint_OpenCapTable_Types.OcfSecurityExemption).decoder, share_numbers_issued: damlTypes.List(Fairmint_OpenCapTable_Types.OcfShareNumberRange).decoder, stock_legend_ids: damlTypes.List(damlTypes.Text).decoder, vestings: damlTypes.List(Fairmint_OpenCapTable_Types.OcfVesting).decoder, board_approval_date: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Time).decoder), consideration_text: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), cost_basis: jtv.Decoder.withDefault(null, damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfMonetary).decoder), issuance_type: jtv.Decoder.withDefault(null, damlTypes.Optional(exports.OcfStockIssuanceType).decoder), stock_plan_id: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), stockholder_approval_date: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Time).decoder), vesting_terms_id: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), }); }),
  encode: function (__typed__) {
  return {
    id: damlTypes.Text.encode(__typed__.id),
    custom_id: damlTypes.Text.encode(__typed__.custom_id),
    date: damlTypes.Time.encode(__typed__.date),
    quantity: damlTypes.Numeric(10).encode(__typed__.quantity),
    security_id: damlTypes.Text.encode(__typed__.security_id),
    share_price: Fairmint_OpenCapTable_Types.OcfMonetary.encode(__typed__.share_price),
    stakeholder_id: damlTypes.Text.encode(__typed__.stakeholder_id),
    stock_class_id: damlTypes.Text.encode(__typed__.stock_class_id),
    comments: damlTypes.List(damlTypes.Text).encode(__typed__.comments),
    security_law_exemptions: damlTypes.List(Fairmint_OpenCapTable_Types.OcfSecurityExemption).encode(__typed__.security_law_exemptions),
    share_numbers_issued: damlTypes.List(Fairmint_OpenCapTable_Types.OcfShareNumberRange).encode(__typed__.share_numbers_issued),
    stock_legend_ids: damlTypes.List(damlTypes.Text).encode(__typed__.stock_legend_ids),
    vestings: damlTypes.List(Fairmint_OpenCapTable_Types.OcfVesting).encode(__typed__.vestings),
    board_approval_date: damlTypes.Optional(damlTypes.Time).encode(__typed__.board_approval_date),
    consideration_text: damlTypes.Optional(damlTypes.Text).encode(__typed__.consideration_text),
    cost_basis: damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfMonetary).encode(__typed__.cost_basis),
    issuance_type: damlTypes.Optional(exports.OcfStockIssuanceType).encode(__typed__.issuance_type),
    stock_plan_id: damlTypes.Optional(damlTypes.Text).encode(__typed__.stock_plan_id),
    stockholder_approval_date: damlTypes.Optional(damlTypes.Time).encode(__typed__.stockholder_approval_date),
    vesting_terms_id: damlTypes.Optional(damlTypes.Text).encode(__typed__.vesting_terms_id),
  };
}
,
};



exports.StockIssuance = damlTypes.assembleTemplate(
{
  templateId: '#OpenCapTable-v25:Fairmint.OpenCapTable.OCF.StockIssuance:StockIssuance',
  keyDecoder: damlTypes.lazyMemo(function () { return jtv.constant(undefined); }),
  keyEncode: function () { throw 'EncodeError'; },
  decoder: damlTypes.lazyMemo(function () { return jtv.object({context: Fairmint_OpenCapTable_Types.Context.decoder, issuance_data: exports.StockIssuanceOcfData.decoder, }); }),
  encode: function (__typed__) {
  return {
    context: Fairmint_OpenCapTable_Types.Context.encode(__typed__.context),
    issuance_data: exports.StockIssuanceOcfData.encode(__typed__.issuance_data),
  };
}
,
  Archive: {
    template: function () { return exports.StockIssuance; },
    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.StockIssuance, ['f53dc3fa0102ffbb24a129fff051d8f337e6992dafc523e4eb622b713b3b3147', '#OpenCapTable-v25']);

