DROP TABLE IF EXISTS users;
CREATE TABLE users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    username TEXT UNIQUE NOT NULL,
    password TEXT NOT NULL
);

-- Masukkan Admin default (Untuk produksi, sebaiknya password di-hash)
INSERT INTO users (username, password) VALUES ('admin', 'admin123');

DROP TABLE IF EXISTS transactions;
CREATE TABLE transactions (
    trx_id TEXT PRIMARY KEY,
    customer_name TEXT NOT NULL,
    customer_email TEXT NOT NULL,
    customer_phone TEXT NOT NULL,
    amount INTEGER NOT NULL,
    status TEXT DEFAULT 'PENDING',
    payment_method TEXT DEFAULT '-',
    fee_amount INTEGER DEFAULT 0,
    net_amount INTEGER DEFAULT 0,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);