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

BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'CalEvent'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml'
    ,p_path               => 'vue-beta');

    xxas_com_sr_pkg.set_rest_method
      (p_service_name       => l_SERVICE
      ,p_method_name        => 'GetMessages'
      ,p_description        => 'Get messages for the angular js to preview beta version'
      ,p_path               => 'messages'
      ,p_methods            => 'GET'
      ,p_remove_root_ele    => true
      ,p_sql                =>
        q'[
           SELECT XMLElement
                   ("data"
                   ,XMLElement
                     ("messages"
                     ,XMLAttributes
                       ('true' as "json:force-array"
                       ,'http://json.org/' as "xmlns:json")
                     ,XMLElement
                       ("message"
                       ,XMLForest
                         (xxas_rslt_cache_pkg.get_message(xxas_util_pkg.app
                                                         ,'XXAS_COM_VUE_BETA_RELEASE_MSG'
                                                         ,userenv('LANG')
                                                         ,'LINK1'
                                                         ,'"' || xxas_com_sec_pkg.get_root_url || '/OA_HTML/b/#/' || '"'
                                                         ,'LINK2'
                                                         ,'"' || 'https://support.applaudsolutions.com/hc/en-us/articles/360020030074-Applaud-version-5-is-now-in-public-beta' || '"') AS "text"
                         ,'positive' AS "mood"
                         ,3000000 AS "timeout")
                       )
                     )
                   ) "data"
           FROM  dual
          ]'
      );

END;
/
COMMIT;
EXIT;
