CREATE DATABASE IF NOT EXISTS telefoncu_crm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE telefoncu_crm;

CREATE TABLE IF NOT EXISTS customers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    first_name VARCHAR(100) NOT NULL,
    last_name VARCHAR(100) NOT NULL,
    device_brand VARCHAR(100) NOT NULL,
    tc_no VARCHAR(11) NULL,
    imei_no VARCHAR(20) NULL,
    document_path VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_name (first_name, last_name),
    INDEX idx_brand (device_brand),
    INDEX idx_tc (tc_no),
    INDEX idx_imei (imei_no),
    INDEX idx_created (created_at)
);
