<?php

namespace App\WhatsAppPlugins\Contracts;

use App\Models\WhatsAppPlugin;

abstract class BaseWhatsAppPlugin implements WhatsAppPluginInterface
{
    public function getVersion(): string
    {
        return '1.0.0';
    }

    public function getAuthor(): string
    {
        return 'AutoDiag';
    }

    public function getIcon(): string
    {
        return '';
    }

    public function getConfigFields(): array
    {
        return [];
    }

    public function validateConfig(array $config): array
    {
        return $config;
    }

    public function isConfigured(WhatsAppPlugin $plugin): bool
    {
        $config = $plugin->config ?? [];
        return !empty($config['number']) || !empty($config['url']);
    }

    public function getChatUrl(WhatsAppPlugin $plugin): string
    {
        return $plugin->config['url'] ?? '';
    }
}
