<?php
/**
 * Contract for editor detection, URLs, and persisted editor preferences.
 *
 * Enables swapping implementations (e.g. tests, alternate config sources) while
 * keeping REST controllers type-safe.
 *
 * @package FleekDash\Services
 */
namespace FleekDash\Services;

if (!defined('ABSPATH')) {
    exit;
}

interface EditorSettingsServiceInterface
{
    /**
     * @return array{id: string, name: string, is_active: bool, edit_url_template: string, builtin?: bool}[]
     */
    public function getDetectedEditors(): array;

    /**
     * @param array<int, array{id: string, name: string, is_active: bool, edit_url_template: string, builtin?: bool}>|null $detected_editors
     */
    public function getEditUrl(
        string $editor_id,
        int $post_id,
        string $post_type = 'post',
        ?array $detected_editors = null,
    ): string;

    /**
     * @return array<string, mixed>
     */
    public function getSettings(): array;

    /**
     * @param array<string, mixed> $settings
     */
    public function updateSettings(array $settings): bool;

    /**
     * @return array<int, array{value: string, label: string}>
     */
    public function getAvailablePostTypes(): array;

    /**
     * Payload for GET/POST editor settings REST (settings + detected + known + post types).
     *
     * @return array<string, mixed>
     */
    public function getFullResponse(): array;
}
