<?php

declare(strict_types=1);

namespace App\Filament\Support;

use Filament\Support\Icons\Heroicon;

/**
 * Infolist / 设置页等 Schema 条目的图标（Outlined 风格）。
 *
 * 约定：业务 Resource 的表格链接列、按钮动作图标见
 * {@see DberpFilamentLinkColumnIconResolver} 与 {@see DberpFilamentActionIconResolver}，
 * 由 {@see DberpFilamentActionConfigurator} 自动注入，勿在页面重复写 ->icon()。
 */
final class DberpFilamentInfolistIconResolver
{
    /**
     * @var array<string, Heroicon>
     */
    private const SECTIONS = [
        'product' => Heroicon::OutlinedCube,
        'license' => Heroicon::OutlinedKey,
        'authorization_overview' => Heroicon::OutlinedShieldCheck,
        'official_service' => Heroicon::OutlinedLifebuoy,
        'update' => Heroicon::OutlinedArrowPath,
    ];

    /**
     * @var array<string, Heroicon>
     */
    private const ENTRIES = [
        'product_name' => Heroicon::OutlinedSparkles,
        'current_version' => Heroicon::OutlinedTag,
        'edition_type' => Heroicon::OutlinedSwatch,
        'release_date' => Heroicon::OutlinedCalendarDays,
        'product_status' => Heroicon::OutlinedSignal,
        'usage_version' => Heroicon::OutlinedIdentification,
        'commercial_authorization' => Heroicon::OutlinedShieldCheck,
        'license_holder' => Heroicon::OutlinedBuildingOffice,
        'license_valid_until' => Heroicon::OutlinedClock,
        'copyright_notice' => Heroicon::OutlinedDocumentText,
        'license_explanation' => Heroicon::OutlinedInformationCircle,
        'official_support' => Heroicon::OutlinedChatBubbleLeftRight,
        'service_status' => Heroicon::OutlinedCloud,
        'service_identifier' => Heroicon::OutlinedQrCode,
        'official_support_entry' => Heroicon::OutlinedArrowTopRightOnSquare,
        'update_current_version' => Heroicon::OutlinedTag,
        'update_status' => Heroicon::OutlinedCheckCircle,
        'version_notes' => Heroicon::OutlinedBookOpen,
        'update_guidance' => Heroicon::OutlinedInformationCircle,
    ];

    public static function section(string $key): Heroicon
    {
        return self::SECTIONS[$key] ?? Heroicon::OutlinedInformationCircle;
    }

    public static function entry(?string $name): Heroicon|string|null
    {
        if ($name === null || $name === '') {
            return null;
        }

        return self::ENTRIES[$name] ?? null;
    }
}
