CREATE TABLE IF NOT EXISTS HEARTBEAT(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    HERTBEAT_INTERVAL INTEGER,
    MGT_API_URL VARCHAR (255),
    TIMESTAMP VARCHAR (20),
    ACCESS_TOKEN VARCHAR (800),
    PRIMARY KEY (GROUP_ID, NODE_ID)
);

CREATE TABLE IF NOT EXISTS SERVERS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID)
);

--CREATE TABLE IF NOT EXISTS PROXY_SERVICES(
--    GROUP_ID VARCHAR (255),
--    NODE_ID VARCHAR (255),
--    NAME VARCHAR (255),
--    DETAILS VARCHAR (5000),
--    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
--);
--
--CREATE TABLE IF NOT EXISTS ENDPOINTS(
--    GROUP_ID VARCHAR (255),
--    NODE_ID VARCHAR (255),
--    NAME VARCHAR (255),
--    DETAILS VARCHAR (5000),
--    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
--);

CREATE TABLE IF NOT EXISTS APIS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS TEMPLATES(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME, DETAILS)
);

CREATE TABLE IF NOT EXISTS SEQUENCES(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS INBOUND_ENDPOINTS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

--CREATE TABLE IF NOT EXISTS MESSAGE_PROCESSORS(
--    GROUP_ID VARCHAR (255),
--    NODE_ID VARCHAR (255),
--    NAME VARCHAR (255),
--    DETAILS VARCHAR (5000),
--    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
--);

CREATE TABLE IF NOT EXISTS TASKS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS LOCAL_ENTRIES(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS CONNECTORS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS CARBON_APPS(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS DATA_SERVICES(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);

CREATE TABLE IF NOT EXISTS DATA_SOURCES(
    GROUP_ID VARCHAR (255),
    NODE_ID VARCHAR (255),
    NAME VARCHAR (255),
    DETAILS VARCHAR (5000),
    PRIMARY KEY (GROUP_ID, NODE_ID, NAME)
);
