<?php
/**
 * iTzAYDiN-BOT Independent Core identity.
 *
 * This file is intentionally dependency-free and can be required from CLI,
 * installer, webhook, panel and Mini App bootstrap code.
 */

declare(strict_types=1);

if (!defined('AYCORE_NAME')) {
    define('AYCORE_NAME', 'iTzAYDiN-BOT');
    define('AYCORE_MARK', 'iTz');
    define('AYCORE_EDITION', 'V7 Modular OS');
    $aycoreVersionFile = dirname(__DIR__) . '/version';
    $aycoreVersion = trim((string) @file_get_contents($aycoreVersionFile));
    define('AYCORE_VERSION', $aycoreVersion !== '' ? $aycoreVersion : '7.0.0-architect');
    unset($aycoreVersionFile, $aycoreVersion);
}

if (!function_exists('aycore_meta')) {
    function aycore_meta(): array
    {
        return [
            'name' => AYCORE_NAME,
            'mark' => AYCORE_MARK,
            'edition' => AYCORE_EDITION,
            'version' => AYCORE_VERSION,
        ];
    }
}

if (!function_exists('aycore_safe_secret_hint')) {
    function aycore_safe_secret_hint($value): string
    {
        $value = trim((string) $value);
        if ($value === '') return 'تنظیم نشده';
        $len = strlen($value);
        if ($len <= 8) return str_repeat('•', max(4, $len));
        return substr($value, 0, 3) . str_repeat('•', min(12, $len - 6)) . substr($value, -3);
    }
}
