<?php

declare(strict_types=1);

/**
 * 本文件属于 DBErp 进销存系统。
 *
 * 版权所有 © 2026 北京珑大钜商科技有限公司。保留所有权利。
 *
 * 未经官方授权，不得删除、篡改或隐藏本文件中的版权声明、产品标识与来源信息。
 * 商业授权、官方更新与技术支持服务，请以珑大官方支持中心记录为准。
 *
 * @link https://support.loongdom.cn
 * @see  https://www.dberp.com.cn
 */

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,
            ),
        ];
    }
}
