CREATE TABLE
    AGT_I_AGENT_HOUR
    (
        AGR_SET_KEY INT NOT NULL,
        DATE_TIME_KEY INT DEFAULT -1,
        GROUP_COMBINATION_KEY INT DEFAULT -1,
        RESOURCE_KEY INT DEFAULT -1,
        TENANT_KEY INT DEFAULT -1,
        MEDIA_TYPE_KEY INT DEFAULT -1,
        INTERACTION_TYPE_KEY INT DEFAULT -1,
        I$OFFERED INT,
        OFFERED INT,
        I$ACCEPTED_EVENTUALLY INT,
        ACCEPTED_EVENTUALLY INT,
        I$ACCEPTED INT,
        ACCEPTED INT,
        I$HOLD INT,
        HOLD INT,
        HOLD_TIME INT,
        I$WRAP INT,
        WRAP INT,
        WRAP_TIME INT,
        INVITE_TIME INT,
        ENGAGE_TIME INT,
        I$CONSULT_RECEIVED_ACCEPTED INT,
        CONSULT_RECEIVED_ACCEPTED INT,
        I$CONSULT_RECEIVED_HOLD INT,
        CONSULT_RECEIVED_HOLD INT,
        CONSULT_RECEIVED_HOLD_TIME INT,
        I$CONSULT_RECEIVED_WRAP INT,
        CONSULT_RECEIVED_WRAP INT,
        CONSULT_RECEIVED_WRAP_TIME INT,
        CONSULT_RECEIVED_ENGAGE_TIME INT,
        I$WRAP_IN INT,
        WRAP_IN INT,
        I$WRAP_OUT INT,
        WRAP_OUT INT,
        I$NOT_READY_IN INT,
        NOT_READY_IN INT,
        I$NOT_READY_OUT INT,
        NOT_READY_OUT INT,
        WRAP_IN_TIME INT,
        WRAP_OUT_TIME INT,
        NOT_READY_IN_TIME INT,
        NOT_READY_OUT_TIME INT
    );

CREATE INDEX
    KAGT_I_AGENT_HOUR
ON
    AGT_I_AGENT_HOUR
    (
        AGR_SET_KEY,
        DATE_TIME_KEY,
        GROUP_COMBINATION_KEY,
        RESOURCE_KEY
    );

CREATE TABLE
    AGT_I_SESS_STATE_HOUR
    (
        AGR_SET_KEY INT NOT NULL,
        DATE_TIME_KEY INT DEFAULT -1,
        GROUP_COMBINATION_KEY INT DEFAULT -1,
        RESOURCE_KEY INT DEFAULT -1,
        TENANT_KEY INT DEFAULT -1,
        MEDIA_TYPE_KEY INT DEFAULT -1,
        ACTIVE_TIME INT,
        READY_TIME INT,
        NOT_READY_TIME INT,
        BUSY_TIME INT,
        WRAP_TIME INT,
        I$READY INT,
        READY INT,
        I$NOT_READY INT,
        NOT_READY INT,
        I$BUSY INT,
        BUSY INT,
        I$WRAP INT,
        WRAP INT
    );

CREATE INDEX
    KAGT_I_SESS_STATE_HOUR
ON
    AGT_I_SESS_STATE_HOUR
    (
        AGR_SET_KEY,
        DATE_TIME_KEY,
        GROUP_COMBINATION_KEY,
        RESOURCE_KEY
    );

CREATE TABLE
    AGT_I_STATE_RSN_HOUR
    (
        AGR_SET_KEY INT NOT NULL,
        DATE_TIME_KEY INT DEFAULT -1,
        GROUP_COMBINATION_KEY INT DEFAULT -1,
        RESOURCE_KEY INT DEFAULT -1,
        TENANT_KEY INT DEFAULT -1,
        RESOURCE_STATE_KEY INT DEFAULT -1,
        RESOURCE_STATE_REASON_KEY INT DEFAULT -1,
        MEDIA_TYPE_KEY INT DEFAULT -1,
        I$STATE_RSN INT,
        STATE_RSN INT,
        STATE_RSN_TIME INT
    );

CREATE INDEX
    KAGT_I_STATE_RSN_HOUR
ON
    AGT_I_STATE_RSN_HOUR
    (
        AGR_SET_KEY,
        DATE_TIME_KEY,
        GROUP_COMBINATION_KEY,
        RESOURCE_KEY
    );