"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.OcfStakeholderStatusType = {
  OcfStakeholderStatusActive: 'OcfStakeholderStatusActive',
  OcfStakeholderStatusLeaveOfAbsence: 'OcfStakeholderStatusLeaveOfAbsence',
  OcfStakeholderStatusTerminationVoluntaryOther: 'OcfStakeholderStatusTerminationVoluntaryOther',
  OcfStakeholderStatusTerminationVoluntaryGoodCause: 'OcfStakeholderStatusTerminationVoluntaryGoodCause',
  OcfStakeholderStatusTerminationVoluntaryRetirement: 'OcfStakeholderStatusTerminationVoluntaryRetirement',
  OcfStakeholderStatusTerminationInvoluntaryOther: 'OcfStakeholderStatusTerminationInvoluntaryOther',
  OcfStakeholderStatusTerminationInvoluntaryDeath: 'OcfStakeholderStatusTerminationInvoluntaryDeath',
  OcfStakeholderStatusTerminationInvoluntaryDisability: 'OcfStakeholderStatusTerminationInvoluntaryDisability',
  OcfStakeholderStatusTerminationInvoluntaryWithCause: 'OcfStakeholderStatusTerminationInvoluntaryWithCause',
  keys: ['OcfStakeholderStatusActive','OcfStakeholderStatusLeaveOfAbsence','OcfStakeholderStatusTerminationVoluntaryOther','OcfStakeholderStatusTerminationVoluntaryGoodCause','OcfStakeholderStatusTerminationVoluntaryRetirement','OcfStakeholderStatusTerminationInvoluntaryOther','OcfStakeholderStatusTerminationInvoluntaryDeath','OcfStakeholderStatusTerminationInvoluntaryDisability','OcfStakeholderStatusTerminationInvoluntaryWithCause',],
  decoder: damlTypes.lazyMemo(function () { return jtv.oneOf(jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusActive), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusLeaveOfAbsence), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationVoluntaryOther), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationVoluntaryGoodCause), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationVoluntaryRetirement), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationInvoluntaryOther), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationInvoluntaryDeath), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationInvoluntaryDisability), jtv.constant(exports.OcfStakeholderStatusType.OcfStakeholderStatusTerminationInvoluntaryWithCause)); }),
  encode: function (__typed__) { return __typed__; },
};



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



exports.OcfContactInfoWithoutName = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({phone_numbers: damlTypes.List(Fairmint_OpenCapTable_Types.OcfPhone).decoder, emails: damlTypes.List(Fairmint_OpenCapTable_Types.OcfEmail).decoder, }); }),
  encode: function (__typed__) {
  return {
    phone_numbers: damlTypes.List(Fairmint_OpenCapTable_Types.OcfPhone).encode(__typed__.phone_numbers),
    emails: damlTypes.List(Fairmint_OpenCapTable_Types.OcfEmail).encode(__typed__.emails),
  };
}
,
};



exports.OcfContactInfo = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({name: exports.OcfName.decoder, phone_numbers: damlTypes.List(Fairmint_OpenCapTable_Types.OcfPhone).decoder, emails: damlTypes.List(Fairmint_OpenCapTable_Types.OcfEmail).decoder, }); }),
  encode: function (__typed__) {
  return {
    name: exports.OcfName.encode(__typed__.name),
    phone_numbers: damlTypes.List(Fairmint_OpenCapTable_Types.OcfPhone).encode(__typed__.phone_numbers),
    emails: damlTypes.List(Fairmint_OpenCapTable_Types.OcfEmail).encode(__typed__.emails),
  };
}
,
};



exports.OcfName = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({legal_name: damlTypes.Text.decoder, first_name: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), last_name: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), }); }),
  encode: function (__typed__) {
  return {
    legal_name: damlTypes.Text.encode(__typed__.legal_name),
    first_name: damlTypes.Optional(damlTypes.Text).encode(__typed__.first_name),
    last_name: damlTypes.Optional(damlTypes.Text).encode(__typed__.last_name),
  };
}
,
};



exports.StakeholderOcfData = {
  decoder: damlTypes.lazyMemo(function () { return jtv.object({id: damlTypes.Text.decoder, name: exports.OcfName.decoder, stakeholder_type: exports.OcfStakeholderType.decoder, addresses: damlTypes.List(Fairmint_OpenCapTable_Types.OcfAddress).decoder, comments: damlTypes.List(damlTypes.Text).decoder, current_relationships: damlTypes.List(Fairmint_OpenCapTable_Types.OcfStakeholderRelationshipType).decoder, tax_ids: damlTypes.List(Fairmint_OpenCapTable_Types.OcfTaxID).decoder, contact_info: jtv.Decoder.withDefault(null, damlTypes.Optional(exports.OcfContactInfoWithoutName).decoder), current_status: jtv.Decoder.withDefault(null, damlTypes.Optional(exports.OcfStakeholderStatusType).decoder), issuer_assigned_id: jtv.Decoder.withDefault(null, damlTypes.Optional(damlTypes.Text).decoder), primary_contact: jtv.Decoder.withDefault(null, damlTypes.Optional(exports.OcfContactInfo).decoder), }); }),
  encode: function (__typed__) {
  return {
    id: damlTypes.Text.encode(__typed__.id),
    name: exports.OcfName.encode(__typed__.name),
    stakeholder_type: exports.OcfStakeholderType.encode(__typed__.stakeholder_type),
    addresses: damlTypes.List(Fairmint_OpenCapTable_Types.OcfAddress).encode(__typed__.addresses),
    comments: damlTypes.List(damlTypes.Text).encode(__typed__.comments),
    current_relationships: damlTypes.List(Fairmint_OpenCapTable_Types.OcfStakeholderRelationshipType).encode(__typed__.current_relationships),
    tax_ids: damlTypes.List(Fairmint_OpenCapTable_Types.OcfTaxID).encode(__typed__.tax_ids),
    contact_info: damlTypes.Optional(exports.OcfContactInfoWithoutName).encode(__typed__.contact_info),
    current_status: damlTypes.Optional(exports.OcfStakeholderStatusType).encode(__typed__.current_status),
    issuer_assigned_id: damlTypes.Optional(damlTypes.Text).encode(__typed__.issuer_assigned_id),
    primary_contact: damlTypes.Optional(exports.OcfContactInfo).encode(__typed__.primary_contact),
  };
}
,
};



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

