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

BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'Person Candidate Pages'
    ,p_path               => '/people/{personId}/candidate/{candidateId}/pages'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml'
    );
   
  xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetCandidatePages'
    ,p_description        => 'Get a candidate''s pages'
    ,p_methods            => 'GET'
    ,p_sql                =>
      q'[
        SELECT xxas_emp_menu_pkg.get_pages_xml
                 (xxas_emp_menu_pkg.menu_name_to_id
                   (fnd_profile.value('XXAS_EMP_REG_VIEWS_MENU'))
                 ,xxas_com_keys_type
                   (xxas_com_named_value_table
                     (xxas_com_named_value_type('PERSON_ID', {pathParam.personId})
                    )
                   )  /* p_keys */ ) "data"
        FROM dual
        ]'
    );
    
END;
/
COMMIT;
EXIT;
