<?php

declare(strict_types=1);

namespace App\Services\SupportCenter;

use App\Enums\SupportCenter\HostInstanceIdentityStatus;

/**
 * 站点实例身份业务展示文案（不含 instance_id 原文以外的技术细节）。
 */
final class HostInstanceIdentityPresenter
{
    public function __construct(
        private readonly HostInstanceIdentityService $identityService,
    ) {}

    public function siteIdentityLabel(): string
    {
        $this->identityService->ensureProvisioned();

        return (string) __('dberp.site_onboarding.instance_identity.site_identity_generated');
    }

    public function officialAccessLabel(): string
    {
        return match ($this->identityService->identityStatus()) {
            HostInstanceIdentityStatus::OfficialAccessBound => (string) __('dberp.site_onboarding.instance_identity.official_access_complete'),
            HostInstanceIdentityStatus::Provisioned => (string) __('dberp.site_onboarding.instance_identity.official_access_pending'),
        };
    }

    public function officialAccessBadgeColor(): string
    {
        return match ($this->identityService->identityStatus()) {
            HostInstanceIdentityStatus::OfficialAccessBound => 'success',
            HostInstanceIdentityStatus::Provisioned => 'gray',
        };
    }

    public function nextStepLabel(): string
    {
        return match ($this->identityService->identityStatus()) {
            HostInstanceIdentityStatus::OfficialAccessBound => (string) __('dberp.site_onboarding.instance_identity.next_step_after_bound'),
            HostInstanceIdentityStatus::Provisioned => (string) __('dberp.site_onboarding.instance_identity.next_step_enter_access_code'),
        };
    }
}
