<?php
require __DIR__ . '/src/Database/DatabaseInterface.php';
require __DIR__ . '/src/Database/JsonDatabase.php';
require __DIR__ . '/src/Models/Model.php';
require __DIR__ . '/src/Models/Category.php';
require __DIR__ . '/src/Models/Brand.php';
require __DIR__ . '/src/Models/Article.php';

use App\Models\Article;
use App\Models\Category;

$cats = Category::all();
echo "CATEGORIES:\n";
foreach ($cats as $c) {
    $count = count(Article::all(['category_slug' => $c->slug]));
    echo "Slug: {$c->slug} -> Name: {$c->name} -> Count: {$count}\n";
}

$all = Article::all();
echo "\nTOTAL ARTICLES: " . count($all) . "\n";
if (!empty($all)) {
    echo "Sample Article Category Slug: " . $all[0]->category_slug . "\n";
}
