-- Schema: ecommerce__olist
CREATE SCHEMA IF NOT EXISTS "ecommerce__olist";

-- Table: customers
CREATE TABLE "ecommerce__olist"."customers" (
    "customer_id" TEXT,
    "customer_unique_id" TEXT,
    "customer_zip_code_prefix" BIGINT,
    "customer_city" TEXT,
    "customer_state" TEXT
);

-- Table: geolocation
CREATE TABLE "ecommerce__olist"."geolocation" (
    "geolocation_zip_code_prefix" BIGINT,
    "geolocation_lat" DOUBLE PRECISION,
    "geolocation_lng" DOUBLE PRECISION,
    "geolocation_city" TEXT,
    "geolocation_state" TEXT
);

-- Table: leads_closed
CREATE TABLE "ecommerce__olist"."leads_closed" (
    "mql_id" TEXT,
    "seller_id" TEXT,
    "sdr_id" TEXT,
    "sr_id" TEXT,
    "won_date" TEXT,
    "business_segment" TEXT,
    "lead_type" TEXT,
    "lead_behaviour_profile" TEXT,
    "has_company" BIGINT,
    "has_gtin" BIGINT,
    "average_stock" TEXT,
    "business_type" TEXT,
    "declared_product_catalog_size" DOUBLE PRECISION,
    "declared_monthly_revenue" DOUBLE PRECISION
);

-- Table: leads_qualified
CREATE TABLE "ecommerce__olist"."leads_qualified" (
    "mql_id" TEXT,
    "first_contact_date" TEXT,
    "landing_page_id" TEXT,
    "origin" TEXT
);

-- Table: order_items
CREATE TABLE "ecommerce__olist"."order_items" (
    "order_id" TEXT,
    "order_item_id" BIGINT,
    "product_id" TEXT,
    "seller_id" TEXT,
    "shipping_limit_date" TEXT,
    "price" DOUBLE PRECISION,
    "freight_value" DOUBLE PRECISION
);

-- Table: order_payments
CREATE TABLE "ecommerce__olist"."order_payments" (
    "order_id" TEXT,
    "payment_sequential" BIGINT,
    "payment_type" TEXT,
    "payment_installments" BIGINT,
    "payment_value" DOUBLE PRECISION
);

-- Table: order_reviews
CREATE TABLE "ecommerce__olist"."order_reviews" (
    "review_id" TEXT,
    "order_id" TEXT,
    "review_score" BIGINT,
    "review_comment_title" TEXT,
    "review_comment_message" TEXT,
    "review_creation_date" TEXT,
    "review_answer_timestamp" TEXT
);

-- Table: orders
CREATE TABLE "ecommerce__olist"."orders" (
    "order_id" TEXT,
    "customer_id" TEXT,
    "order_status" TEXT,
    "order_purchase_timestamp" TEXT,
    "order_approved_at" TEXT,
    "order_delivered_carrier_date" TEXT,
    "order_delivered_customer_date" TEXT,
    "order_estimated_delivery_date" TEXT
);

-- Table: product_category_name_translation
CREATE TABLE "ecommerce__olist"."product_category_name_translation" (
    "product_category_name" TEXT,
    "product_category_name_english" TEXT
);

-- Table: products
CREATE TABLE "ecommerce__olist"."products" (
    "product_id" TEXT,
    "product_category_name" TEXT,
    "product_name_lenght" DOUBLE PRECISION,
    "product_description_lenght" DOUBLE PRECISION,
    "product_photos_qty" DOUBLE PRECISION,
    "product_weight_g" DOUBLE PRECISION,
    "product_length_cm" DOUBLE PRECISION,
    "product_height_cm" DOUBLE PRECISION,
    "product_width_cm" DOUBLE PRECISION
);

-- Table: sellers
CREATE TABLE "ecommerce__olist"."sellers" (
    "seller_id" TEXT,
    "seller_zip_code_prefix" BIGINT,
    "seller_city" TEXT,
    "seller_state" TEXT
);
