-- Hook Report table for storing hook report data from RDS
-- This table is populated by the Glue job rds_to_s3_hook_report_hourly_upsert
-- which dumps data from RDS to S3 and then loads it into Snowflake
-- Clustered by partition date and hour for optimal query performance
CREATE TRANSIENT TABLE IF NOT EXISTS {hook_report_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID VARCHAR(255),                                    -- Unique hook report identifier
    
    -- Timestamps
    CREATED_AT TIMESTAMP_TZ(9),                         -- When the report was created
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    
    -- Report details
    REPORT_TYPE TEXT,                                   -- Type of report (spam, inappropriate, etc.)
    REPORT_REASON TEXT,                                 -- Detailed reason for the report
    
    -- References
    HOOK_ID VARCHAR(255),                               -- Associated hook identifier
    USER_ID INTEGER,                                    -- User who submitted the report
    
    -- Partitioning columns for optimization
    P_DATE DATE,                                        -- Partition date based on created_at
    P_HOUR NUMBER(38,0)                                 -- Partition hour (0-23) based on created_at
);

