CREATE TABLE products (
    id CHAR(36) PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    price DECIMAL(10, 2) NOT NULL,
    category ENUM('Kayu', 'Buah-buahan', 'Tanaman_Hias') NOT NULL,
    stock INT NOT NULL DEFAULT 0,
    discount_percent DECIMAL(5, 2) DEFAULT NULL CHECK (discount_percent >= 0 AND discount_percent <= 100),
    is_featured BOOLEAN DEFAULT FALSE,
    images JSON,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_category (category),
    INDEX idx_is_featured (is_featured),
    INDEX idx_stock (stock)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
