/******************************************************************************/
// @copyright   Copyright Notification
//   No part may be reproduced except as authorized by written permission.
//   The copyright and the foregoing restriction extend to reproduction in all media.
//   (c) 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
//   All rights reserved.
// @version: IWD_23wk37
// $Date: 2021-03-20 15:05:59 +0100 (Sat, 20 Mar 2021) $
// $Rev: 30244 $
/******************************************************************************/

module NasEmu5G_Component_NR_BASE {
  import from NR_ASP_SrbDefs all;
  import from NasEmu5G_AspTypes_NR all;
  import from NR_Component_Base all;

  //----------------------------------------------------------------------------
  // Component definition:
  type component NASEMU_NR_BASE_PTC {  /* @status    APPROVED (ENDC, IMS, NR5GC, NR5GC_IRAT, POS) */
    port NASEMU_NR_SYSTEM_PORT    SYS_SRB;
    port NASEMU_NR_SRB_PORT       TC_SRB;
  };

  type component NASEMU_NR_SYSTEM {  /* @status    APPROVED (ENDC, IMS, NR5GC, NR5GC_IRAT, POS) */
    port NASEMU_NR_SYSTEM_PORT    NR_SRB;
  };

  //----------------------------------------------------------------------------
  /*
   * @desc      Create NASEMU, connect it with NR5G PTC and map the system ports
   * @param     p_System
   * @param     p_NR_BASE
   * @return    NASEMU_NR_BASE_PTC
   * @status    APPROVED (ENDC)
   */
  function f_NasEmu5G_CreateConnectAndMap_NR_BASE(NASEMU_NR_SYSTEM p_System,
                                                  NR_BASE_PTC p_NR_BASE) return NASEMU_NR_BASE_PTC
  {
    var NASEMU_NR_BASE_PTC v_NASEMU_NR_BASE_PTC := null;
    
    if (p_NR_BASE != null) {
      
      // create NAS emulation:
      v_NASEMU_NR_BASE_PTC := NASEMU_NR_BASE_PTC.create("NASEMU_NR_BASE") alive;  // @sic R5s210270 sic@
      
      // connect NAS emulation:
      connect(p_NR_BASE:SRB,      v_NASEMU_NR_BASE_PTC:TC_SRB);
      
      // map NASEMU system ports:
      map(v_NASEMU_NR_BASE_PTC:SYS_SRB, p_System:NR_SRB);
    }
    return v_NASEMU_NR_BASE_PTC;
  }

}
