<?php

declare(strict_types=1);

namespace PpPhp\Plugins;

use PpPhp\Core\PluginSupport;
use PpPhp\Core\ViewPlugin;

class LongDate implements ViewPlugin
{
    use PluginSupport;

    public static function id(): string { return 'LongDate'; }
    public static function label(): string { return 'Long Date'; }
    public static function version(): string { return '1.1.0'; }
    public static function description(): string { return 'Displays a date in long form (e.g. January 5, 2026), timezone-aware, with an optional custom format.'; }

    public static function render(mixed $value, array $settings): string
    {
        return self::formatDate($value, 'F j, Y', $settings);
    }

    public static function settingsSchema(): array
    {
        return [['key' => 'format', 'type' => 'text', 'label' => 'Custom format', 'default' => '', 'hint' => 'Optional PHP date() format; blank = January 5, 2026.']];
    }

    public static function assets(): array { return ['js' => [], 'css' => []]; }
}
