-- MySQL schema for contaazul-sync
CREATE DATABASE IF NOT EXISTS contaazul_sync DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE contaazul_sync;

CREATE TABLE IF NOT EXISTS products (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    contaazul_id VARCHAR(100) NOT NULL UNIQUE,
    codigo VARCHAR(100),
    nome VARCHAR(255),
    categoria VARCHAR(255),
    valor_venda DECIMAL(12,2) NULL,
    custo_medio DECIMAL(12,2) NULL,
    estoque INT NULL,
    ultima_atualizacao DATETIME NULL,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX (codigo),
    INDEX (categoria)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
