import bribrain

spark = bribrain.sparkSession()


# Dataframe 1: Data Penjualan
df_sales = spark.createDataFrame([
    {"produk": "Laptop", "qty": 10, "harga": 15000000},
    {"produk": "Mouse", "qty": 50, "harga": 250000},
    {"produk": "Keyboard", "qty": 30, "harga": 750000},
])

df_sales.show()


# Dataframe 2: Data Pelanggan
df_customers = spark.createDataFrame([
    {"customer_id": 1, "nama": "Alice", "kota": "Jakarta"},
    {"customer_id": 2, "nama": "Bob", "kota": "Bandung"},
    {"customer_id": 3, "nama": "Charlie", "kota": "Surabaya"},
])

df_customers.show()


# Dataframe 3: Data Stok
df_stock = spark.createDataFrame([
    {"kode_barang": "A001", "nama_barang": "Laptop", "stok": 100},
    {"kode_barang": "A002", "nama_barang": "Mouse", "stok": 500},
    {"kode_barang": "A003", "nama_barang": "Keyboard", "stok": 300},
])

df_stock.show()

bribrain.load_to_excel(
    [df_sales, df_customers, df_stock],
    "test_multi",
    sheet_name=["Penjualan", "Pelanggan", "Stok"],
    download=True,
)


