-- Create Payment Gateways Table
CREATE TABLE IF NOT EXISTS payment_gateways (
    id INT AUTO_INCREMENT PRIMARY KEY,
    provider VARCHAR(50) NOT NULL UNIQUE, -- duitku, xendit, etc
    merchant_code VARCHAR(255),
    api_key VARCHAR(255),
    callback_token VARCHAR(255),
    is_sandbox TINYINT(1) DEFAULT 1,
    is_active TINYINT(1) DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Insert defaults if not exist
INSERT IGNORE INTO
    payment_gateways (
        provider,
        merchant_code,
        api_key,
        is_sandbox,
        is_active
    )
VALUES ('duitku', '', '', 1, 0),
    ('xendit', '', '', 1, 0);