import { renderBigCode } from './big-code.js';
import { t } from './i18n.js';
import { PAIRING_CODE_TTL_MINUTES } from './pairing-ttl.js';
/** Pairing code: plain ASCII (A–Z, 0–9) for app input. */
function pairingCodeAscii(code) {
    return code.replace(/[^A-Z0-9]/g, '').slice(0, 6);
}
export function printPairingToTerminal(identity) {
    const code = pairingCodeAscii(identity.pairingCode);
    console.log(t('pairing.runningInBackground'));
    console.log('');
    console.log('────────────────────────────────────────');
    console.log('');
    console.log(t('pairing.computer', { name: identity.machineLabel }));
    console.log('');
    console.log(t('pairing.enterCodeInApp'));
    console.log('');
    console.log(`  ${code}`);
    console.log('');
    console.log(renderBigCode(code));
    console.log('');
    console.log(t('pairing.codeSingleUse'));
    console.log(t('pairing.codeValidMinutes', { minutes: PAIRING_CODE_TTL_MINUTES }));
    console.log('');
    console.log('────────────────────────────────────────');
    console.log(`  ${t('pairing.stopHint')}`);
    console.log(`  ${t('pairing.consoleCanClose')}`);
    console.log('');
}
