-- Create or replace usage plan table with full snapshot from S3
CREATE OR REPLACE TABLE {usage_plan_table_name} AS
SELECT 
    $1:id::VARCHAR(255) as id,
    $1:created_at::TIMESTAMP_TZ(9) as created_at,
    $1:updated_at::TIMESTAMP_TZ(9) as updated_at,
    $1:level::NUMBER(38,0) as level,
    $1:name::VARCHAR(255) as name,
    $1:monthly_price_usd::NUMBER(38,0) as monthly_price_usd,
    $1:features::VARCHAR(16777216) as features,
    $1:stripe_product_id::VARCHAR(255) as stripe_product_id,
    $1:stripe_annual_price_id::VARCHAR(255) as stripe_annual_price_id,
    $1:stripe_monthly_price_id::VARCHAR(255) as stripe_monthly_price_id,
    $1:daily_credits::NUMBER(38,0) as daily_credits,
    $1:monthly_credits::NUMBER(38,0) as monthly_credits,
    $1:annual_price_usd::NUMBER(38,0) as annual_price_usd,
    $1:plan_key::VARCHAR(16777216) as plan_key
FROM {stage_path} (file_format => 'BASIC_PARQUET_LOADER', pattern => ('.*.parquet'));

