/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2016 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
                       := 'PersonItemActions';
                       
BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'Interact with a person''s item actions'
    ,p_path               => '/people/{personId}'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml'
    );

  xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetPersonItemActions'
    ,p_description        => 'Get a person''s item actions'
    ,p_methods            => 'GET'
    ,p_path               => 'item-actions'	
    ,p_remove_root_ele    => true
    ,p_sql                =>
      q'[
        SELECT xxas_emp_menu_pkg.get_person_item_actions_xml
                 ({pathParam.personId}) "actions"
        FROM   dual
        ]'        
    );

  xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetAssignmentItemActions'
    ,p_description        => 'Get a assignment''s item actions'
    ,p_methods            => 'GET'
    ,p_path               => '{assignmentId}/item-actions'
    ,p_remove_root_ele    => true	
    ,p_sql                =>
      q'[
        SELECT xxas_emp_menu_pkg.get_person_item_actions_xml
                 ({pathParam.personId},{pathParam.assignmentId}) "actions"
        FROM   dual
        ]'        
    );
	
END;
/
COMMIT;
EXIT;
