<?php

declare(strict_types=1);

namespace PpPhp\Core;

/**
 * Every display/edit plugin must implement this interface.
 *
 * A plugin is a self-contained folder inside plugins/ containing:
 *   - manifest.json
 *   - Plugin.php (implements this interface)
 *   - plugin.js   (optional)
 *   - plugin.css  (optional)
 *   - assets/     (optional third-party files)
 */
interface FieldPlugin
{
    /** Unique machine name, e.g. "ColorPicker" */
    public static function id(): string;

    /** Human-readable label shown in dropdowns */
    public static function label(): string;

    /** "view" (display only), "edit" (input only), or "both" */
    public static function category(): string;

    /** Which MySQL types this plugin supports (empty array = all) */
    public static function supportedTypes(): array;

    /** Render the View (display) HTML */
    public static function renderView(mixed $value, array $settings): string;

    /** Render the Edit (input) HTML */
    public static function renderEdit(string $fieldName, mixed $value, array $settings): string;

    /** Return a JSON-serialisable settings schema for the gear modal */
    public static function settingsSchema(): array;

    /** Return relative paths to JavaScript files (from plugin folder) */
    public static function jsFiles(): array;

    /** Return relative paths to CSS files (from plugin folder) */
    public static function cssFiles(): array;
}