<?php

declare(strict_types=1);

namespace App\Setting;

use App\Services\SupportCenter\HostInstallationIdentityService;
use App\Services\SupportCenter\HostInstanceCredentialStore;
use App\Services\SupportCenter\HostSiteOnboardingLastAttemptStore;
use App\Services\SupportCenter\HostSiteOnboardingStatusCacheStore;
use DBCore\Setting\Contracts\SettingDefinitionProviderInterface;
use DBCore\Setting\Data\SettingDefinition;
use DBCore\Setting\Data\SettingGroup;

/**
 * DBErp 宿主侧 DBCore Setting 定义（安装标识等内部持久化项）。
 */
final class DberpHostSettingDefinitionProvider implements SettingDefinitionProviderInterface
{
    public function getGroups(): array
    {
        return [
            new SettingGroup('host.installation', '宿主安装标识'),
            new SettingGroup('host.site_onboarding', '系统接入快照'),
        ];
    }

    public function getDefinitions(): array
    {
        return [
            new SettingDefinition(
                key: HostInstallationIdentityService::SETTING_KEY,
                group: 'host.installation',
                label: '站点安装实例 ID',
                type: 'string',
                default: null,
                scope: [],
                nullable: true,
                visible: false,
            ),
            new SettingDefinition(
                key: HostInstanceCredentialStore::SETTING_KEY,
                group: 'host.installation',
                label: '站点安装签名密钥（加密）',
                type: 'string',
                default: null,
                scope: [],
                nullable: true,
                visible: false,
            ),
            new SettingDefinition(
                key: HostSiteOnboardingLastAttemptStore::SETTING_KEY,
                group: 'host.site_onboarding',
                label: '最近接入尝试快照',
                type: 'json',
                default: null,
                scope: [],
                nullable: true,
                visible: false,
            ),
            new SettingDefinition(
                key: HostSiteOnboardingStatusCacheStore::SETTING_KEY,
                group: 'host.site_onboarding',
                label: '最近绑定状态快照',
                type: 'json',
                default: null,
                scope: [],
                nullable: true,
                visible: false,
            ),
        ];
    }
}
