<?php

namespace App\Services\Content;

class PostUploadPath
{
    /**
     * Type → top-level klasör adı.
     */
    public static function folder(string $type): string
    {
        return match ($type) {
            'announcement' => 'announcements',
            'kb_article'   => 'kb',
            'blog_post'    => 'blog',
            default        => throw new \InvalidArgumentException("Unknown post type: {$type}"),
        };
    }

    /**
     * Date-bucketed path (Y/m/d). Optional subFolder (örn. 'featured', 'inline').
     */
    public static function buildDatedPath(string $type, string $subFolder = ''): string
    {
        $base = self::folder($type);
        $date = now()->format('Y/m/d');

        return $subFolder !== ''
            ? "{$base}/{$subFolder}/{$date}"
            : "{$base}/{$date}";
    }
}
