CREATE TABLE IF NOT EXISTS branches (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    address TEXT,
    phone VARCHAR(20),
    pic VARCHAR(100), -- Person In Charge
    is_active TINYINT(1) DEFAULT 1,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Insert Head Office if empty
INSERT IGNORE INTO
    branches (
        id,
        name,
        address,
        phone,
        pic,
        is_active
    )
VALUES (
        1,
        'Pusat (Head Office)',
        'Alamat Pusat',
        '08123456789',
        'Owner',
        1
    );