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

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

DECLARE

  --
  -- Local constants and variables
  --
  l_SERVICE CONSTANT xxas_com_service_repository.service_name%TYPE
                       := 'Absencelist';

BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'Get Absence list'
    ,p_path               => 'absence-list'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml');
    
  xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetAbsenceList'
    ,p_description        => 'Get Absence List'
    ,p_methods            => 'GET'
    ,p_path               => '{person_id}'
    ,p_remove_root_ele    => true
    ,p_sql                =>
      q'[
         SELECT xxas_absence_event_pkg.team_absencences_list(p_absence_type       => {requestParam.type}
                                                            ,p_due_days           => to_number({requestParam.dueDays})
                                                            ,p_saved_search_id    => to_number({requestParam.savedSearchId})
                                                            ,p_auth_function      => 'XXAS_DT_ABSENCE_LIST'
                                                            ,p_person_id          => to_number({pathParam.person_id}))  "data"
         FROM   dual
        ]'
    );

END;
/
COMMIT;
EXIT;
