```php
<?php

require_once '../../core/api_bootstrap.php';


require_once '../../core/employee_auth.php';
EmployeeAuth::check('manage_blog');

$data = Request::post();

try {

Validator::required($data,[
'title'
]);

$db = new Database();
$conn = $db->connect();

$title = Helper::sanitize($data['title']);

$slug = Slug::generateUnique(
'blog_posts',
'slug',
$title
);

$featured_image = null;

if(isset($_FILES['featured_image'])){
$featured_image = Upload::image('featured_image','blog');
}

$query="

INSERT INTO blog_posts
(
category_id,
title,
slug,
content,
featured_image,
featured_image_alt,
meta_title,
meta_description,
schema_markup,
status,
published_at
)

VALUES
(
:category_id,
:title,
:slug,
:content,
:featured_image,
:featured_image_alt,
:meta_title,
:meta_description,
:schema_markup,
:status,
:published_at
)

";

$stmt=$conn->prepare($query);

$stmt->execute([

':category_id'=>$data['category_id'] ?? null,
':title'=>$title,
':slug'=>$slug,
':content'=>$data['content'] ?? null,
':featured_image'=>$featured_image,
':featured_image_alt'=>$data['featured_image_alt'] ?? null,
':meta_title'=>$data['meta_title'] ?? null,
':meta_description'=>$data['meta_description'] ?? null,
':schema_markup'=>$data['schema_markup'] ?? null,
':status'=>$data['status'] ?? 'draft',
':published_at'=>$data['published_at'] ?? null

]);

$id=$conn->lastInsertId();

Logger::activity(
ApiAuth::employeeId(),
"create",
"blog_posts",
$id,
ApiAuth::ip()
);

Response::success([
"id"=>$id
],"Blog post created");

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());

Response::error("Server error",500);

}