-- Usage Plan table for storing subscription plan configurations from RDS
-- This table is populated by the Glue job rds_to_s3_bots_usageplan_daily_all
-- Full snapshot table - replaced daily
CREATE TRANSIENT TABLE IF NOT EXISTS {usage_plan_table_name} (
    -- Primary identifier
    ID VARCHAR(255),                                    -- Unique plan identifier
    
    -- Timestamps
    CREATED_AT TIMESTAMP_TZ(9),                         -- When the plan was created
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    
    -- Plan details
    LEVEL NUMBER(38,0),                                 -- Plan tier level
    NAME VARCHAR(255),                                  -- Plan name
    PLAN_KEY VARCHAR(16777216),                         -- Plan key identifier
    
    -- Pricing - Monthly
    MONTHLY_PRICE_USD NUMBER(38,0),                     -- Monthly price in USD
    STRIPE_MONTHLY_PRICE_ID VARCHAR(255),               -- Stripe monthly price ID
    
    -- Pricing - Annual
    ANNUAL_PRICE_USD NUMBER(38,0),                      -- Annual price in USD
    STRIPE_ANNUAL_PRICE_ID VARCHAR(255),                -- Stripe annual price ID
    
    -- Stripe integration
    STRIPE_PRODUCT_ID VARCHAR(255),                     -- Stripe product ID
    
    -- Credits allocation
    DAILY_CREDITS NUMBER(38,0),                         -- Daily credits allocation
    MONTHLY_CREDITS NUMBER(38,0),                       -- Monthly credits allocation
    
    -- Features
    FEATURES VARCHAR(16777216)                          -- JSON or text of plan features
) COMMENT='Full snapshot of usage plans from RDS billing_usageplan table';

