

-- Creating the 'document_logs' table
CREATE TABLE IF NOT EXISTS STG.DOCUMENT_LOGS 
(
    DOCUMENT_ID VARCHAR NOT NULL,
    BATCH_ID VARCHAR NOT NULL,
    JOB_ID VARCHAR,
    STAGE VARCHAR,
    TEXTRACT_STATUS VARCHAR,
    BUCKET_NAME VARCHAR NOT NULL,
    FILE_NAME VARCHAR NOT NULL,
    FILE_PATH VARCHAR,
    DOCUMENT_TYPE VARCHAR,
    PAYER_SIGNED BOOLEAN,
    PROVIDER_SIGNED BOOLEAN,
    GROUP_ID VARCHAR,
    CREATED_TIME TIMESTAMP,
    MODIFIED_TIME TIMESTAMP,
    CREATED_BY VARCHAR,
    MODIFIED_BY VARCHAR,
    ORIGINAL_FILE_EXTENSION VARCHAR,
    NO_OF_PAGES NUMERIC,
    FILE_SIZE NUMERIC,
    PRIMARY KEY (DOCUMENT_ID)
);

-- Creating the 'batch_logs' table
CREATE TABLE IF NOT EXISTS STG.BATCH_LOGS (
    BATCH_ID VARCHAR NOT NULL,
    CLIENT_ID VARCHAR,
    EXECUTION_START_TIME TIMESTAMP,
    NO_OF_DOCUMENTS NUMBER,
    USER_NAME VARCHAR,
    PRIMARY KEY (BATCH_ID)
);

-- Creating the 'client_logs' table
CREATE TABLE IF NOT EXISTS STG.CLIENT_LOGS (
    CLIENT_ID VARCHAR ,
    CLIENT_NAME VARCHAR,
    BUCKET_NAME VARCHAR,
    PRIMARY KEY (CLIENT_ID)
);
