CREATE TABLE IF NOT EXISTS pakasir_transactions (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  transaction_id VARCHAR(64) NOT NULL UNIQUE,
  package_code VARCHAR(50) NOT NULL,
  package_name VARCHAR(100) NOT NULL,
  amount INT NOT NULL,
  wa_number VARCHAR(30) NOT NULL,
  outlet_code VARCHAR(50) NULL,
  status ENUM('PENDING','PAID','FAILED','EXPIRED') NOT NULL DEFAULT 'PENDING',
  payment_url TEXT NULL,
  voucher_code VARCHAR(64) NULL,
  provider_payload JSON NULL,
  created_at DATETIME NOT NULL,
  updated_at DATETIME NOT NULL
);

CREATE INDEX idx_pakasir_tx_status ON pakasir_transactions(status);
CREATE INDEX idx_pakasir_tx_wa ON pakasir_transactions(wa_number);
