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

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

DECLARE
  e_obj_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_obj_not_exists, -04043);
BEGIN
  EXECUTE IMMEDIATE 'DROP TYPE XXAS_P11D_REPORT_VARRAY FORCE';
EXCEPTION
  WHEN e_obj_not_exists THEN
    NULL;
END;
/

DECLARE
  e_obj_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_obj_not_exists, -04043);
BEGIN
  EXECUTE IMMEDIATE 'DROP TYPE XXAS_P11D_REPORT_TYPE FORCE';
EXCEPTION
  WHEN e_obj_not_exists THEN
    NULL;
END;
/

DECLARE
  e_obj_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_obj_not_exists, -04043);
BEGIN
  EXECUTE IMMEDIATE 'DROP TYPE XXAS_P60_REPORT_VARRAY FORCE';
EXCEPTION
  WHEN e_obj_not_exists THEN
    NULL;
END;
/

DECLARE
  e_obj_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_obj_not_exists, -04043);
BEGIN
  EXECUTE IMMEDIATE 'DROP TYPE XXAS_P60_REPORT_TYPE FORCE';
EXCEPTION
  WHEN e_obj_not_exists THEN
    NULL;
END;
/

CREATE OR REPLACE TYPE XXAS_P11D_REPORT_TYPE AS OBJECT
  (p11d_report_id        number
  ,template              varchar2(400)
  ,summary_context       varchar2(4000)
  ,summary_text          varchar2(4000)
  ,summary_message       varchar2(4000)
  ,rest_api_path         varchar2(400))
/

CREATE OR REPLACE TYPE XXAS_P11D_REPORT_VARRAY AS
VARRAY(100000) OF XXAS_P11D_REPORT_TYPE
/

CREATE OR REPLACE TYPE XXAS_P60_REPORT_TYPE AS OBJECT
  (p60_report_id         number
  ,template              varchar2(400)
  ,summary_context       varchar2(4000)
  ,summary_text          varchar2(4000)
  ,summary_message       varchar2(4000)
  ,rest_api_path         varchar2(400)
  ,report_type           varchar2(30))
/

CREATE OR REPLACE TYPE XXAS_P60_REPORT_VARRAY AS
VARRAY(100000) OF XXAS_P60_REPORT_TYPE
/

COMMIT;
EXIT;
