Rem drv: <create type="types" pos="emInternalSDK/events/events_types.sql+"/>
Rem
Rem $Header: emcore/source/oracle/sysman/emdrep/sql/core/latest/events/events_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:14 rbali Exp $
Rem
Rem events_types.sql
Rem
Rem Copyright (c) 2010, 2025, Oracle and/or its affiliates. 
Rem All rights reserved.

Rem BEGIN EMRU_FILE_METADATA
Rem EMRU_SOURCE_FILE:emcore/source/oracle/sysman/emdrep/sql/core/latest/events/events_types.sql
Rem EMRU_UNIX_DELIVERABLES:
Rem emcore/source/oracle/sysman/emdrep/sql/core/latest/events/events_types.sql

Rem EMRU_FILE_POSTINSTALL:<!!! enter the view based location of the executable file. If there is NONE leave as-is !!!>
Rem EMRU_GENERIC_FLAG:NONE
Rem END EMRU_FILE_METADATA

Rem
Rem    NAME
Rem      events_types.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      Creation of the events related pl/sql types for internal use
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    gbafna      02/03/25 - 
Rem    gbafna      01/07/25 - make synonyms noneditionable
Rem    dselim      08/30/15 - Adde "FORCE" key word to create em_event_attr_obj
Rem                           statement
Rem    dselim      08/11/15 - Add default English description to bug fix
Rem    dselim      05/05/15 - Need to store event class and attribute default
Rem                           english labels in repository - bug 20983450.
Rem    rnadidar    02/11/15 - cut over to EBR
Rem    dselim      01/20/15 - Define association object to be used to store all
Rem                           associations defined per rule.
Rem    dselim      01/09/15 - Add em_ev_corln_cached_obj to hold
Rem                           values we cache when we evaluatecorrelation rules
Rem                           for incoming events.
Rem    edcaball    10/16/14 - Added grouping attributes from table em_incident_grp_criteria.
Rem    rrmohana    09/19/14 - Adding context_attr_ref_view under em_event_class
Rem    jricoir     08/14/14 - Added created_during_blackout to em_inc_basic_details_rec
Rem    sreddy      07/09/14 - blackout project
Rem    dselim      06/10/14 - Rename EM_EV_ID_PAIR as EM_EV_CORRELATION_PART,
Rem                           rename EM_EV_ID_PAIR_LIST as
Rem                           EM_EV_CORRELATION_PART_LIST in order to add
Rem                           fields for rule-based correlation.
Rem    zeding      05/27/14 - support mapping 1 event to multi-CA
Rem    zeding      03/27/14 - grouping id to event object
Rem    zeding      03/05/13 - additional atribute: clear_event_source for
Rem                           em_event_class_obj
Rem    jianpeng    11/15/12 - bug14462949 - for fresh install, create plsql
Rem                           types in one go for event model types
Rem    jianpeng    12/28/11 - 12.1.0.2 types upgrade
Rem    rsidlagh    01/15/10 - Created
Rem    zeding      01/13/10 - events pl/sql objects
Rem    zeding      01/13/10 - Created
Rem

CREATE OR REPLACE TYPE em_event_attr_enum_obj AS OBJECT
(enum_value              VARCHAR2(64),
 name                    VARCHAR2(64),
 nlsid                   VARCHAR2(64),
 event_ui_display_order  NUMBER(3),
 inc_ui_display_order    NUMBER(3),
 pblm_ui_display_order   NUMBER(3),
 CONSTRUCTOR FUNCTION em_event_attr_enum_obj
 (p_enum_value              IN VARCHAR2,
  p_name                    IN VARCHAR2 DEFAULT NULL,
  p_nlsid                   IN VARCHAR2 DEFAULT NULL,
  p_event_ui_display_order  IN NUMBER DEFAULT 0,
  p_inc_ui_display_order    IN NUMBER DEFAULT 0,
  p_pblm_ui_display_order   IN NUMBER DEFAULT 0
 ) 
 RETURN SELF AS RESULT
) 
/

CREATE OR REPLACE TYPE em_event_attr_enum_array 
AS VARRAY(100) OF em_event_attr_enum_obj 
/

CREATE OR REPLACE TYPE em_event_attr_obj FORCE AS OBJECT
(name                  VARCHAR2(30),
 nlsid                 VARCHAR2(64),
 data_type             VARCHAR2(10),
 attr_type             VARCHAR2(10),
 desc_nlsid            VARCHAR2(64),
 description           VARCHAR2(512),
 label                 VARCHAR2(256),
 is_translated         NUMBER(1),
 is_referenced         NUMBER(1),
 signature_order       NUMBER(3),
 rules_order           NUMBER(3),
 apply_rules_on_change NUMBER(1),
 notif_order           NUMBER(3),
 CONSTRUCTOR FUNCTION em_event_attr_obj
 (p_name                  VARCHAR2,
  p_nlsid                 VARCHAR2 DEFAULT NULL,
  p_data_type             VARCHAR2 DEFAULT 'STRING',
  p_attr_type             VARCHAR2 DEFAULT 'CLASS',
  p_desc_nlsid            VARCHAR2 DEFAULT NULL,
  p_description           VARCHAR2 DEFAULT NULL,
  p_label                 VARCHAR2 DEFAULT NULL,
  p_is_translated         NUMBER DEFAULT 0,
  p_is_referenced         NUMBER DEFAULT 0,
  p_signature_order       NUMBER DEFAULT 0,
  p_rules_order           NUMBER DEFAULT 0,
  p_apply_rules_on_change NUMBER DEFAULT 0,
  p_notif_order           NUMBER DEFAULT 0
 )
 RETURN SELF AS RESULT
) 
/

CREATE OR REPLACE TYPE em_event_attr_array AS 
VARRAY(200) OF em_event_attr_obj 
/

CREATE OR REPLACE TYPE em_event_class_obj AS OBJECT
(event_class            VARCHAR2(20),
 version                NUMBER,
 plugin_id              VARCHAR2(64),
 nlsid                  VARCHAR2(64),
 desc_nlsid             VARCHAR2(64),
 description            VARCHAR2(512),
 label                  VARCHAR2(256),
 target_aware           NUMBER,
 source_object_type     VARCHAR2(30),
 resource_bundle        VARCHAR2(512),
 table_name             VARCHAR2(30),
 ref_attr_source        VARCHAR2(512),
 attr_list              em_event_attr_array,
 valid_severity_levels  mgmt_integer_array,
 xml_content            CLOB,
 clear_event_source     VARCHAR2(128),
 context_attr_ref_view   VARCHAR2(30),
 CONSTRUCTOR FUNCTION em_event_class_obj 
  (p_event_class             IN VARCHAR2,
   p_version                 IN NUMBER,
   p_plugin_id               IN VARCHAR2,
   p_nlsid                   IN VARCHAR2,
   p_desc_nlsid              IN VARCHAR2 DEFAULT NULL,
   p_description             IN VARCHAR2 DEFAULT NULL,
   p_label                   IN VARCHAR2 DEFAULT NULL,
   p_target_aware            IN NUMBER DEFAULT 1,
   p_source_object_type      IN VARCHAR2,
   p_resource_bundle         IN VARCHAR2,
   p_table_name              IN VARCHAR2,
   p_ref_attr_source         IN VARCHAR2 DEFAULT NULL,
   p_clear_event_source      IN VARCHAR2 DEFAULT NULL,
   p_context_attr_ref_view   IN VARCHAR2 DEFAULT NULL,
   p_attr_list               IN em_event_attr_array,
   p_valid_severity_levels   IN mgmt_integer_array,
   p_xml_content             IN CLOB  DEFAULT NULL
  )
  RETURN SELF AS RESULT
) 
/

CREATE OR REPLACE TYPE em_event_class_array 
AS VARRAY(100) OF em_event_class_obj 
/

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

CREATE OR REPLACE TYPE em_any_guid_array as VARRAY(2000) of RAW(16);
/

grant execute on em_any_guid_array to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_any_guid_array');
END;
/

CREATE OR REPLACE TYPE em_ev_annotation_obj AS OBJECT (
  annotation_type      NUMBER(1),
  annotation_date      DATE,
  annotation_user      VARCHAR2(256),
  message              VARCHAR2(4000),
  message_nlsid        VARCHAR2(64),
  message_params       VARCHAR2(4000),
  resource_bundle      VARCHAR2(512),
  severity             NUMBER(2),
  annotation_seq       NUMBER,
  is_hidden            NUMBER(1),
 CONSTRUCTOR FUNCTION em_ev_annotation_obj (
  p_annotation_type      IN NUMBER,
  p_annotation_date      IN DATE     DEFAULT NULL,
  p_annotation_user      IN VARCHAR2,
  p_message              IN VARCHAR2,
  p_message_nlsid        IN VARCHAR2 DEFAULT NULL,
  p_message_params       IN VARCHAR2 DEFAULT NULL,
  p_resource_bundle      IN VARCHAR2 DEFAULT NULL,
  p_is_hidden            IN NUMBER   DEFAULT 0
 ) 
 RETURN SELF AS RESULT
);
/

grant execute on em_ev_annotation_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_annotation_obj');
END;
/

CREATE OR REPLACE TYPE em_ev_annotation_array AS VARRAY(2000) of EM_EV_ANNOTATION_OBJ;
/

grant execute on em_ev_annotation_array to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_annotation_array');
END;
/

CREATE OR REPLACE TYPE em_ev_udt_prop_obj AS OBJECT (
  name                 VARCHAR2(64),
  value                VARCHAR2(4000),
  label                VARCHAR2(256),
  nls_id               VARCHAR2(64)
);
/

grant execute on em_ev_udt_prop_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_udt_prop_obj');
END;
/

CREATE OR REPLACE TYPE em_ev_udt_prop_array AS VARRAY(2000) OF EM_EV_UDT_PROP_OBJ;
/

grant execute on em_ev_udt_prop_array to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_udt_prop_array');
END;
/

CREATE OR REPLACE TYPE em_ev_source_info_obj AS OBJECT (
  target_guid          RAW(16),
  attributes           gc_event_pair_array,
  properties           gc_event_pair_array,
  udt_properties       em_ev_udt_prop_array,
  source_obj_type      VARCHAR2(30),
  source_obj_id        RAW(16),
  source_obj_name      VARCHAR2(256),
  source_obj_owner     VARCHAR2(256),
  source_obj_sub_type  VARCHAR2(64)
);
/

grant execute on em_ev_source_info_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_source_info_obj');
END;
/
  
CREATE OR REPLACE TYPE em_ev_ca_obj AS OBJECT (
  ca_execution_id         RAW(16),
  ca_status               NUMBER(2),
  ca_job_details          gc_event_pair_array,
  ca_reference_id         RAW(16),
  ca_update_date          DATE,
  reference_source_type   NUMBER(2)
);
/

grant execute on em_ev_ca_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_ca_obj');
END;
/

CREATE OR REPLACE TYPE em_ev_source_info_array AS VARRAY(4000) OF EM_EV_SOURCE_INFO_OBJ;
/

grant execute on em_ev_source_info_array to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_source_info_array');
END;
/

CREATE OR REPLACE TYPE em_ev_ca_array AS VARRAY(200) OF EM_EV_CA_OBJ;
/

grant execute on em_ev_ca_array to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_ev_ca_array');
END;
/

CREATE OR REPLACE TYPE em_event_obj UNDER gc_event_publish_obj (
  event_instance_id       RAW(16),
  event_seq_id            RAW(16),
  signature_id            RAW(16),
  open_status             NUMBER(1),
  closed_date             DATE,
  total_duplicate_count   NUMBER,
  first_evt_occurred_date DATE,
  last_evt_occurred_date  DATE,
  has_ca_job              NUMBER(1),
  ca_job_info             em_ev_ca_obj,
  event_creation_date     DATE,
  seq_creation_date       DATE,
  last_updated_date       DATE,
  last_severity_change    DATE,
  incident_id             RAW(16),
  prev_severity           NUMBER(2),
  trigger_instance_id     RAW(16),
  is_suppressed           NUMBER(1),
  correlation_state       NUMBER(1),
  is_root_cause           NUMBER(1),
  is_symptom              NUMBER(1),
  curr_evt_instance_id    RAW(16),
  event_severity          NUMBER(2),
  source_obj_details      em_ev_source_info_obj,
  target_group_array      em_any_guid_array,
  change_attr_list        mgmt_short_string_array,
  rule_owners_priv        mgmt_medium_string_array,
  annotations_array       em_ev_annotation_array,
  repo_sysdate_utc        DATE,
  incident_num            NUMBER(16),
  perf_data               gc_event_pair_array,
  processing_status       NUMBER(1),
  processing_priority     NUMBER(4),
  rca_next_ca_date        DATE,
  rca_next_sa_date        DATE,
  grouping_signature_id   RAW(16),
  ca_job_info_array       em_ev_ca_array,
  created_during_blackout NUMBER(1),
 CONSTRUCTOR FUNCTION em_event_obj (
  p_event_class        IN VARCHAR2,
  p_event_instance_id  IN RAW DEFAULT NULL,
  p_signature_id       IN RAW DEFAULT NULL 
 ) 
 RETURN SELF AS RESULT,
 MEMBER PROCEDURE compute_change_attribs
   (p_event_obj        IN em_event_obj,
    p_attr_change_list OUT mgmt_short_string_array
   ) 
);
/

grant execute on em_event_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_event_obj');
END;
/

CREATE OR REPLACE TYPE em_issue_obj AS OBJECT (
  summary_info              gc_ev_msg_info,
  open_status               NUMBER(1),
  closed_date               DATE,
  creation_date             DATE,
  is_adr_aware              NUMBER(1),
  has_summary_edited        NUMBER(1),
  is_ack                    NUMBER(1),
  priority                  NUMBER(2),
  resolution_state          VARCHAR2(32),
  owner                     VARCHAR2(256),
  is_suppressed             NUMBER(1),
  suppression_type          NUMBER(2),
  suppressed_until          DATE,
  is_escalated              NUMBER(1),
  escalated_level           NUMBER(1),
  last_ack_change           DATE,
  last_priority_change      DATE,
  last_res_state_change     DATE,
  last_owner_change         DATE,
  last_escalated_change     DATE,
  last_suppress_change      DATE,
  assoc_entity_tot_count    NUMBER,
  assoc_entity_close_count  NUMBER,
  display_tz                VARCHAR2(64),
  last_updated_date         DATE,
  categories                mgmt_short_string_array,
  source_info_array         em_ev_source_info_array,
  group_array               em_any_guid_array,
  rule_owners_priv          mgmt_medium_string_array,
  annotations_array         em_ev_annotation_array,
  change_attr_list          mgmt_short_string_array,
  repo_sysdate_utc          DATE,
  perf_data                 gc_event_pair_array,
  processing_status         NUMBER(1),
  processing_priority       NUMBER(4),
  issue_type                NUMBER(1),
  severity                  NUMBER(2),
  previous_severity         NUMBER(2),
  last_severity_change      DATE,
  processing_hints          GC_EVENT_PAIR_ARRAY,
  last_processed_severity NUMBER(2)
) NOT FINAL NOT INSTANTIABLE ;
/

grant execute on em_issue_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_issue_obj');
END;
/

CREATE OR REPLACE TYPE em_incident_obj UNDER em_issue_obj (
  incident_id               RAW(16),
  incident_num              NUMBER(16),
  related_problem_id        RAW(16),
  is_auto_close             NUMBER(1),
  creation_rule_id          NUMBER,
  trigger_event_seq         RAW(16),
  adr_incident_id           NUMBER(20),
  ticket_status             VARCHAR2(64),
  ticket_id                 VARCHAR2(128),
  ecid                      VARCHAR2(64),
  impact                    VARCHAR2(512),
  related_problem_num       NUMBER(16),
  problem_key               VARCHAR2(850),
  cause_event_count         NUMBER(6),
  symptom_event_count       NUMBER(6),
  neither_event_count       NUMBER(6),
  grouping_signature_id     RAW(16),
  grouping_attributes       gc_event_pair_array,
  ticket_type               VARCHAR2(20),
 CONSTRUCTOR FUNCTION em_incident_obj (
  p_incident_id IN RAW DEFAULT NULL
 ) 
 RETURN SELF AS RESULT
);
/


grant execute on em_incident_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_incident_obj');
END;
/

CREATE OR REPLACE TYPE em_problem_obj UNDER em_issue_obj (
  problem_id                RAW(16),
  problem_num               NUMBER(16),
  problem_key               VARCHAR2(850),
  is_packaged               NUMBER(1),
  sr_id                     VARCHAR2(64),
  bug_id                    VARCHAR2(64),
  trigger_incident_id       RAW(16),
  adr_problem_id            NUMBER(20),
 CONSTRUCTOR FUNCTION em_problem_obj (
  p_problem_id IN RAW DEFAULT NULL
 ) 
 RETURN SELF AS RESULT
);
/

grant execute on em_problem_obj to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('em_problem_obj');
END;
/

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;

CREATE OR REPLACE TYPE em_ev_cust_view_attr_obj AS OBJECT (
  attr_name                VARCHAR2(30),
  operator_code            VARCHAR2(64),
  attr_value               VARCHAR2(4000),
  issue_type               NUMBER
);
/

CREATE OR REPLACE TYPE em_ev_cust_view_date_obj AS OBJECT (
  attr_name                VARCHAR2(30),
  search_type              NUMBER,
  units                    VARCHAR2(10),
  date_value               VARCHAR2(10),
  start_date               DATE,
  end_date                 DATE,
  issue_type               NUMBER
);
/

CREATE OR REPLACE TYPE em_ev_cust_view_param_obj AS OBJECT (
  param_name               VARCHAR2(64),
  param_value              VARCHAR2(4000),
  issue_type               NUMBER
) ;
/

CREATE OR REPLACE TYPE em_ev_cview_attr_array 
   AS VARRAY(1000) OF em_ev_cust_view_attr_obj;
/

CREATE OR REPLACE TYPE em_ev_cview_date_array 
   AS VARRAY(1000) OF em_ev_cust_view_date_obj;
/

CREATE OR REPLACE TYPE em_ev_cview_param_array 
   AS VARRAY(1000) OF em_ev_cust_view_param_obj;
/

CREATE OR REPLACE TYPE em_ev_cust_view_obj AS OBJECT (
  view_id                   NUMBER,
  view_name                 VARCHAR2(128),
  user_name                 VARCHAR2(256),
  view_label                VARCHAR2(64),
  view_label_nlsid          VARCHAR2(64),
  view_label_bundle         VARCHAR2(512),
  created_at                DATE,
  updated_at                DATE,
  out_of_box                NUMBER,
  issue_type                NUMBER,
  display_order             NUMBER,
  attr_conditions           em_ev_cview_attr_array,
  date_conditions           em_ev_cview_date_array,
  param_conditions          em_ev_cview_param_array
);
/

-- Used to hold the collected summary records displayed summary
-- data for incidents across categories or target types
--   category         - category for the row. (0 if the display is across
--                      the target types)
--   target_type      - target type for the row (null if display is across
--                      the categories)
--   fatal_count      - count of incidents with fatal severity for the 
--                      category or target type
--   critical_count   - count of incidents with critical severity for the 
--                      category or target type
--   warning_count    - count of incidents with warning severity for the 
--                      category or target type
--   escalated_count  - count of escalated incidents for category or target type
CREATE OR REPLACE TYPE em_inc_sum_record IS OBJECT (
  category        NUMBER(12),
  target_type     VARCHAR2(64),
  fatal_count     NUMBER(10),
  critical_count  NUMBER(10),
  warning_count   NUMBER(10),
  escalated_count NUMBER(10)
);
/

-- Used to hold the collected summary records displayed summary
-- data for incidents across categories or target types
CREATE OR REPLACE TYPE em_inc_sum_array IS VARRAY(500) OF
  em_inc_sum_record;
/
-- Used to display basic details of related incident
CREATE OR REPLACE TYPE em_inc_basic_details_rec IS OBJECT (
  incident_id       RAW(16),
  severity          NUMBER(2),
  target_guid       RAW(16),
  target_name       VARCHAR2(256),
  target_type       VARCHAR2(64),
  category          NUMBER(12),
  creation_date     DATE,
  last_upd_date     DATE,
  summary_msg       VARCHAR2(4000),
  summary_nlsid     VARCHAR2(64),
  summary_nlsparams VARCHAR2(4000),
  summary_resbundle VARCHAR2(512),
  incident_tz       VARCHAR2(64),
  event_seq_id      RAW(16),
  incident_num      NUMBER(16),
  created_during_blackout NUMBER(1)
);
/

-- Used to hold list of related incidents
CREATE OR REPLACE TYPE em_inc_basic_det_array IS VARRAY(1000) OF 
  em_inc_basic_details_rec;
/

-- Used to display basic details of related problems
CREATE OR REPLACE TYPE em_prb_basic_details_rec IS OBJECT (
  problem_id        RAW(16),
  target_guid       RAW(16),
  target_name       VARCHAR2(256),
  target_type       VARCHAR2(64),
  category          NUMBER(12),
  creation_date     DATE,
  last_upd_date     DATE,
  summary_msg       VARCHAR2(4000),
  summary_nlsid     VARCHAR2(64),
  summary_nlsparams VARCHAR2(4000),
  summary_resbundle VARCHAR2(512),
  problem_tz        VARCHAR2(64),
  problem_key       VARCHAR2(850),
  sr_number         VARCHAR2(64),
  bug_number        VARCHAR2(64),
  inc_counts        NUMBER(12)
);
/

-- Used to hold list of related incidents
CREATE OR REPLACE TYPE em_prb_basic_det_array IS VARRAY(100) OF 
  em_prb_basic_details_rec;
/

CREATE OR REPLACE TYPE EM_EV_RCA_TARGET AS OBJECT (
    target_guid   RAW(16),
    target_type   VARCHAR2(64),
    target_name   VARCHAR2(256),
    relationship  NUMBER(1) -- 0: Dependent target, 1: Parent target
  );
/

CREATE OR REPLACE TYPE EM_EV_RCA_TARGET_LIST AS TABLE OF EM_EV_RCA_TARGET;
/

-- This type saves information for the event that correlates with the incoming
-- event. We save event and sequence ID, as well as pattern ID if
-- this was the result of a rule-based correlation.
--
-- in_ev_pattern_id is the pattern ID that matched for the incoming event.
-- It is used to save matching patterns in the DB.
--
CREATE OR REPLACE TYPE EM_EV_CORRELATION_PART AS OBJECT (
    event_instance_id RAW(16),
    event_seq_id      RAW(16),
    pattern_id           NUMBER(10),
    in_ev_pattern_id     NUMBER(10)
  );
/

CREATE OR REPLACE TYPE EM_EV_CORRELATION_PART_LIST AS TABLE OF EM_EV_CORRELATION_PART;
/

-- Used to save rows in em_event_rca_tgt_assoc_pttrn table.
-- Meanings of columns are definied in events_rca_tables.sql
-- and repeated here for convenience:
--       RULE_ID - Uniquely Identifies the rule. Used internally to retrieve
--                 a rule and its related event pattern and associations.
--
--       SAME_TGT_OR_COMP - T: same target
--                          C: same target and component
--                          N: Neither conditions above are set (default).
--                             This means that the two events are not on the same
--                             target or target component.
--
--       SRC_PATTERN_ID - Uniquely Identifies the source pattern, which is LHS
--                        of the association
--
--       SRC_ENTITY_TYPE - T: Target
--                         C: Target Component
--
--       DEST_PATTERN_ID - Uniquely Identifies the dest pattern, which is LHS
--                         of the association
--
--       DEST_ENTITY_TYPE - T: Target
--                          C: Target Component
--
--       ASSOC_TYPE - association between specified targets, such as depends_on
--
CREATE OR REPLACE TYPE EM_EV_TGT_ASSOC_REC AS OBJECT (
 rule_id  NUMBER(10),
 same_tgt_or_comp VARCHAR2(1),
 src_pattern_id NUMBER(10),
 src_entity_type VARCHAR2(1),
 dest_pattern_id NUMBER(10),
 dest_entity_type VARCHAR2(1),
 assoc_type VARCHAR2(256)
  );
/

CREATE OR REPLACE TYPE EM_EV_TGT_ASSOC_LIST AS TABLE OF EM_EV_TGT_ASSOC_REC;
/

-- Used to display basic details of related events
CREATE OR REPLACE TYPE em_rel_event_details_rec IS OBJECT (
  event_seq_id      RAW(16),
  trigger_event_instance_id RAW(16),
  open_status       NUMBER,
  closed_date       DATE,
  event_class       VARCHAR2(20),
  target_name       VARCHAR2(256),
  target_type       VARCHAR2(64),
  target_guid       RAW(16),
  signature_id      RAW(16),
  creation_date     DATE,
  metric_name       VARCHAR2(256),
  metric_col        VARCHAR2(256),
  key_value         VARCHAR2(256)
);
/

-- Used to display details of event severity state with message
CREATE OR REPLACE TYPE em_event_history_rec IS OBJECT (
  severity      NUMBER,
  --event_msg     GC_EV_MSG_INFO,
  msg           VARCHAR2(4000),
  msg_nlsid     VARCHAR2(256),
  msg_nlsparams VARCHAR2(4000),
  msg_resbundle VARCHAR2(512),
  creation_date DATE,
  closed_date   DATE
);
/

-- Used to hold list of related events info
CREATE OR REPLACE TYPE em_rel_event_det_array IS VARRAY(100) OF
  em_rel_event_details_rec;
/

-- Used to hold list of event severity state changes with message
CREATE OR REPLACE TYPE em_event_history_array IS VARRAY(500) OF 
  em_event_history_rec;
/

-- Used to hold cached correlation rule filtering patterns
CREATE OR REPLACE TYPE em_ev_corln_cached_obj IS OBJECT (
  rule_id           NUMBER(10),
  target_type       VARCHAR2(64),
  event_class       VARCHAR2(20),
  op                VARCHAR2(4)
);
/

-- Used to hold list of cached pattern conditions for all enabled rules
CREATE OR REPLACE TYPE em_ev_corln_cached_array IS VARRAY(100) OF
  em_ev_corln_cached_obj;
/



