"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.OcfInitialSharesAuthorized = {
  decoder: damlTypes.lazyMemo(function () { return jtv.oneOf(jtv.object({tag: jtv.constant('OcfInitialSharesNumeric'), value: damlTypes.Numeric(10).decoder, }), jtv.object({tag: jtv.constant('OcfInitialSharesEnum'), value: exports.OcfAuthorizedShares.decoder, })); }),
  encode: function (__typed__) {
  switch(__typed__.tag) {
    case 'OcfInitialSharesNumeric': return {tag: __typed__.tag, value: damlTypes.Numeric(10).encode(__typed__.value)};
    case 'OcfInitialSharesEnum': return {tag: __typed__.tag, value: exports.OcfAuthorizedShares.encode(__typed__.value)};
    default: throw 'unrecognized type tag: ' + __typed__.tag + ' while serializing a value of type OcfInitialSharesAuthorized';
  }
}
,
};



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



exports.IssuerOcfData = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({id: damlTypes.Text.decoder, country_of_formation: damlTypes.Text.decoder, formation_date: damlTypes.Time.decoder, legal_name: damlTypes.Text.decoder, comments: damlTypes.List(damlTypes.Text).decoder, tax_ids: damlTypes.List(Fairmint_OpenCapTable_Types.OcfTaxID).decoder, address: jtv.Decoder.withDefault(null, damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfAddress).decoder), country_subdivision_of_formation: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), country_subdivision_name_of_formation: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), dba: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), email: jtv.Decoder.withDefault(null, damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfEmail).decoder), initial_shares_authorized: jtv.Decoder.withDefault(null, damlTypes.Optional(exports.OcfInitialSharesAuthorized).decoder), phone: jtv.Decoder.withDefault(null, damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfPhone).decoder), }); }),
  encode: function (__typed__) {
  return {
    id: damlTypes.Text.encode(__typed__.id),
    country_of_formation: damlTypes.Text.encode(__typed__.country_of_formation),
    formation_date: damlTypes.Time.encode(__typed__.formation_date),
    legal_name: damlTypes.Text.encode(__typed__.legal_name),
    comments: damlTypes.List(damlTypes.Text).encode(__typed__.comments),
    tax_ids: damlTypes.List(Fairmint_OpenCapTable_Types.OcfTaxID).encode(__typed__.tax_ids),
    address: damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfAddress).encode(__typed__.address),
    country_subdivision_of_formation: damlTypes.Optional(damlTypes.Text).encode(__typed__.country_subdivision_of_formation),
    country_subdivision_name_of_formation: damlTypes.Optional(damlTypes.Text).encode(__typed__.country_subdivision_name_of_formation),
    dba: damlTypes.Optional(damlTypes.Text).encode(__typed__.dba),
    email: damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfEmail).encode(__typed__.email),
    initial_shares_authorized: damlTypes.Optional(exports.OcfInitialSharesAuthorized).encode(__typed__.initial_shares_authorized),
    phone: damlTypes.Optional(Fairmint_OpenCapTable_Types.OcfPhone).encode(__typed__.phone),
  };
}
,
};



exports.Issuer = damlTypes.assembleTemplate(
{
  templateId: '#OpenCapTable-v25:Fairmint.OpenCapTable.OCF.Issuer:Issuer',
  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, issuer_data: exports.IssuerOcfData.decoder, }); }),
  encode: function (__typed__) {
  return {
    context: Fairmint_OpenCapTable_Types.Context.encode(__typed__.context),
    issuer_data: exports.IssuerOcfData.encode(__typed__.issuer_data),
  };
}
,
  Archive: {
    template: function () { return exports.Issuer; },
    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.Issuer, ['b5f040df7d2aee4825ee0e890eee83ede65d88d2d127aaaeaaa119e70c22bdf9', '#OpenCapTable-v25']);

