"use strict";
(function () {
  const
    control_existingDocumentsContainer = document.getElementById("ExistingDocumentsContainer"),
    control_newIdentificationDocumentContainer = document.getElementById("NewIdentificationDocumentContainer"),
    control_uploadNewIdentificationRadios = document.getElementsByName("UploadNewIdentification");

  function _bindEvents() {

    control_uploadNewIdentificationRadios.forEach(radio => {
      radio.addEventListener("change", _radioOptionChanged)
    });
  }

  function _init() {
    _bindEvents();

    _radioOptionChanged(null);
  }

  function _radioOptionChanged(sender) {
    let uploadNewIdentificationDocument = sender?.target?.value ?? "true";
    if (uploadNewIdentificationDocument === "true") {
      jfa.utilities.element.hide(control_existingDocumentsContainer);
      jfa.utilities.element.show(control_newIdentificationDocumentContainer)
    }
    else {
      jfa.utilities.element.show(control_existingDocumentsContainer);
      jfa.utilities.element.hide(control_newIdentificationDocumentContainer)
    }
  }

  _init();
})();