/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2008 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  --
  -- Local constants
  --
  --
  l_BUSINESS_PROC CONSTANT varchar2(2)  := 'BP';
  l_BEFORE_PROC   CONSTANT varchar2(2)  := 'BP';
  l_AFTER_PROC    CONSTANT varchar2(2)  := 'AP';
  l_CALL_PKG      CONSTANT varchar2(30) := 'XXAS_OUT_OLM_CALENDAR_EVENTS';
  l_YES           CONSTANT varchar2(1)  := 'Y';
  l_MODULE_PKG    varchar2(30);

  /* DOES NOTHING - UPDATE VAR TO FORCE TO RUN IN PATCH */
  l_Version       CONSTANT varchar2(10) := '1.5';

  l_api_module_id number;

BEGIN
  l_MODULE_PKG  := 'OTA_DELEGATE_BOOKING_API';
  --
  -- Register the Delegate Booking After Create Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'CREATE_DELEGATE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_AFTER_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'CREATE_DELEGATE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'CREATE_DELEGATE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  --
  -- Register the Delegate Booking After Update Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'UPDATE_DELEGATE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'UPDATE_DELEGATE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'UPDATE_DELEGATE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  --
  -- Register the Delegate Booking After Delete Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'DELETE_DELEGATE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'DELETE_DELEGATE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'DELETE_DELEGATE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  l_MODULE_PKG    := 'OTA_RESOURCE_BOOKING_API';

  --
  -- Register the Resource Booking After Create Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'CREATE_RESOURCE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_AFTER_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'CREATE_RESOURCE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'CREATE_RESOURCE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  --
  -- Register the Resource Booking After Update Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'UPDATE_RESOURCE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'UPDATE_RESOURCE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'UPDATE_RESOURCE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  --
  -- Register the Resource Delegate Booking After Delete Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'DELETE_RESOURCE_BOOKING'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'DELETE_RESOURCE_BOOKING'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'DELETE_RESOURCE_BOOKING';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  l_MODULE_PKG   := 'OTA_EVENT_API';
  --
  -- Register the Class After Update Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'UPDATE_CLASS'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'UPDATE_EVENT'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'UPDATE_CLASS';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

  --
  -- Register the Class Booking After Delete Hook
  --
  XXAS_util_pkg.register_api_hook
    (p_module_package => l_MODULE_PKG
    ,p_module_name    => 'DELETE_CLASS'
    ,p_module_type    => l_BUSINESS_PROC
    ,p_hook_type      => l_BEFORE_PROC
    ,p_call_package   => l_CALL_PKG
    ,p_call_procedure => 'DELETE_EVENT'
    ,p_enabled_flag   => l_YES);

  select api_module_id
  into l_api_module_id from hr_api_modules
  where module_name = 'DELETE_CLASS';

  hr_api_user_hooks_utility.create_hooks_add_report(l_api_module_id);

END;
/
COMMIT;
EXIT;
