-- Create Table
CREATE TABLE IF NOT EXISTS shipping_rates (
    id INT AUTO_INCREMENT PRIMARY KEY,
    location_name VARCHAR(150) NOT NULL,
    cost DECIMAL(12,2) NOT NULL DEFAULT 0,
    is_default TINYINT(1) DEFAULT 0,
    is_active TINYINT(1) DEFAULT 1,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Seed Default Data (Run only if empty)
INSERT INTO shipping_rates (location_name, cost, is_default)
SELECT 'Luar Kota Padang (Flat Rate)', 70000, 1
WHERE NOT EXISTS (SELECT 1 FROM shipping_rates);

INSERT INTO shipping_rates (location_name, cost, is_default)
SELECT 'Kota Padang', 20000, 0
WHERE NOT EXISTS (SELECT 1 FROM shipping_rates WHERE location_name = 'Kota Padang');
