CREATE TABLE events (
    id INT AUTO_INCREMENT PRIMARY KEY,
    settlement_id INT NOT NULL,
    title VARCHAR(255) NOT NULL,
    type ENUM('kerdoiv', 'workshop', 'eloadas', 'konferencia') NOT NULL,
    location VARCHAR(255) DEFAULT NULL,
    event_date DATE DEFAULT NULL,
    content TEXT DEFAULT NULL,
    status ENUM('draft', 'scheduled', 'published') NOT NULL DEFAULT 'draft',
    publish_at DATETIME DEFAULT NULL,
    sort_order INT NOT NULL DEFAULT 0,
    is_highlighted TINYINT(1) NOT NULL DEFAULT 0,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_events_status (settlement_id, status),
    INDEX idx_events_type (settlement_id, type),
    CONSTRAINT fk_events_settlement FOREIGN KEY (settlement_id) REFERENCES settlements(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
