<?php
namespace PpPhp\Plugins;
use PpPhp\Core\EditPlugin;

class TextArea implements EditPlugin
{
    public static function id(): string { return 'TextArea'; }
    public static function label(): string { return 'Text Area'; }
    public static function version(): string { return '1.0.0'; }
    public static function description(): string { return 'A multi-line text input with configurable rows.'; }
    public static function render(string $fieldName, mixed $value, array $settings): string {
        $rows = (int)($settings['rows'] ?? 4);
        return '<textarea name="' . $fieldName . '" rows="' . $rows . '" class="form-control">' . htmlspecialchars($value ?? '') . '</textarea>';
    }
    public static function settingsSchema(): array {
        return [ ['key'=>'rows', 'type'=>'number', 'label'=>'Rows', 'default'=>4] ];
    }
    public static function assets(): array { return ['js'=>[], 'css'=>[]]; }
}