<?php

/**
 * LolaCore — Translatable strings for the admin chat widget (JS).
 *
 * @package LolaCore
 * @license GPL-2.0-or-later
 */

declare(strict_types=1);

namespace LolaCore\I18n;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Centralizes chat UI copy for wp_localize_script / translation extraction.
 */
class ChatUiStrings {

	/**
	 * Strings passed to lolacore-chat.js.
	 *
	 * @return array<string, mixed>
	 */
	public static function forScript(): array {
		return array(
			'thinkingProfessional' => array(
				\__( 'Thinking…', 'lolacore' ),
				\__( 'Looking into it…', 'lolacore' ),
				\__( 'Let me check a few things…', 'lolacore' ),
				\__( 'Going through the details…', 'lolacore' ),
				\__( 'Processing your request…', 'lolacore' ),
				\__( 'Connecting a few pieces…', 'lolacore' ),
				\__( 'Give me a second on this one…', 'lolacore' ),
				\__( 'On it…', 'lolacore' ),
			),
			'thinkingPersonality'  => array(
				\__( 'Hmm, trickier than I thought…', 'lolacore' ),
				\__( 'Hold on — I want to get this right.', 'lolacore' ),
				\__( 'OK, I see what\'s going on here…', 'lolacore' ),
				\__( 'Don\'t rush me.', 'lolacore' ),
				\__( 'This deserves a proper answer…', 'lolacore' ),
				\__( 'I have opinions about this. One sec.', 'lolacore' ),
				\__( 'Let me approach this differently…', 'lolacore' ),
				\__( 'OK let me focus a bit harder…', 'lolacore' ),
			),
			'thinkingLongWait'     => array(
				\__( 'Still working — this one needs extra attention.', 'lolacore' ),
				\__( 'Taking a bit longer than usual…', 'lolacore' ),
				\__( 'Bear with me, almost cracked it…', 'lolacore' ),
			),
			'widgetOnline'         => \__( 'ONLINE', 'lolacore' ),
			'widgetMinimize'       => \__( 'Minimize', 'lolacore' ),
			'widgetNewSession'     => \__( 'New session', 'lolacore' ),
			'onboardingAnalyzing'  => \__( 'Analyzing your site…', 'lolacore' ),
			'onboardingPlugins'    => \__( 'Reviewing plugins and security…', 'lolacore' ),
			'onboardingProfile'    => \__( 'Building your site profile…', 'lolacore' ),
			'inputPlaceholder'     => \__( 'Write to Lola...', 'lolacore' ),
			'typingIndicator'      => \__( 'Lola is thinking…', 'lolacore' ),
			'disclaimer'           => \__( 'Lola is an AI and can make mistakes. Please review actions before confirming.', 'lolacore' ),
			'greetingReady'        => \__( 'Hello. I\'m ready. What shall we look into today?', 'lolacore' ),
			'greetingContinue'     => \__( 'Shall we continue or start something new?', 'lolacore' ),
			'lastSessionSummary'   => \__( 'Last session summary:', 'lolacore' ),
			'onboardingBlock'      => \__( 'I\'ve reviewed your site and the report is ready. To get started, I need you to connect an AI provider in Settings → Connectors. You\'ll need an account with the provider and an API key — about 5 minutes, and the Connectors screen links you to the right place for each one.', 'lolacore' ),
			'continuityGreeting'   => \__( 'Still waiting on that AI provider so we can get started. The button below takes you there — about 5 minutes.', 'lolacore' ),
			'continuityPlaceholder'=> \__( 'Connect an AI provider to chat with me', 'lolacore' ),
			'firstRealGreetingFallback' => \__( 'Now I can see your site. I went over the initial report — ask me anything, or tell me to walk you through what I found.', 'lolacore' ),
			'configureConnectors'  => \__( 'Configure AI Connectors', 'lolacore' ),
			'scanCompleteShort'    => \__( 'I\'ve completed the initial scan of your site.', 'lolacore' ),
			'scanCompleteSummary'  => \__( 'I\'ve completed the initial scan of your site. Here\'s your summary:', 'lolacore' ),
			'reportTitle'          => \__( 'Initial System Report', 'lolacore' ),
			'reportStatus'         => \__( 'Status:', 'lolacore' ),
			'reportHealthy'        => \__( 'Healthy', 'lolacore' ),
			'reportNeedsAttention' => \__( 'Needs Attention', 'lolacore' ),
			'reportWordPress'      => \__( 'WordPress:', 'lolacore' ),
			'reportPhp'            => \__( 'PHP:', 'lolacore' ),
			'reportTheme'          => \__( 'Active Theme:', 'lolacore' ),
			'reportPlugins'        => \__( 'Plugins:', 'lolacore' ),
			'reportContent'        => \__( 'Content:', 'lolacore' ),
			'reportDatabase'       => \__( 'Database:', 'lolacore' ),
			'reportActive'         => \__( 'active', 'lolacore' ),
			'reportInstalled'      => \__( 'installed', 'lolacore' ),
			'reportPosts'          => \__( 'posts', 'lolacore' ),
			'reportPages'          => \__( 'pages', 'lolacore' ),
			'connectionError'      => \__( 'I couldn\'t get a response. This is usually a temporary connection issue — try sending your message again. If it keeps happening, check that your AI provider is still connected in Settings → Connectors.', 'lolacore' ),
			'databaseError'        => \__( 'I ran into a database problem on your site before my reply could load in the chat. Refresh the page and try again. If it keeps happening, update LolaCore — it is usually a missing plugin table, not your hosting.', 'lolacore' ),
			'firewallBlocked'      => \__( 'Your hosting security layer blocked this request before it reached WordPress. Ask your host to allow admin-ajax.php for logged-in administrators, or try again from another network.', 'lolacore' ),
			'serverTimeoutError'   => \__( 'The server took too long to answer and the connection dropped. Try again in a moment, or ask a simpler question first.', 'lolacore' ),
			'ajaxEmptyError'       => \__( 'WordPress returned an empty response — the request may have been interrupted. Refresh the page and try again.', 'lolacore' ),
			'invalidResponseError' => \__( 'I got a garbled response from the server — not your hosting blocking the message, but something broke the reply format. Refresh and try again; if it persists, update LolaCore.', 'lolacore' ),
			'approvalRequired'     => \__( 'I need your approval to proceed:', 'lolacore' ),
			'previewFailed'        => \__( 'Preview failed', 'lolacore' ),
			'approvalRequiredTitle'=> \__( 'Approval required', 'lolacore' ),
			'actionLabel'          => \__( 'Action', 'lolacore' ),
			'approveExecute'       => \__( 'Approve and execute', 'lolacore' ),
			'previewFixTitle'      => \__( 'Fix the preview error before executing.', 'lolacore' ),
			'dismiss'              => \__( 'Dismiss', 'lolacore' ),
			'cancel'               => \__( 'Cancel', 'lolacore' ),
			'executing'            => \__( 'Executing…', 'lolacore' ),
			'cancelling'           => \__( 'Cancelling…', 'lolacore' ),
			'executed'             => \__( 'Executed', 'lolacore' ),
			'cancelled'            => \__( 'Cancelled', 'lolacore' ),
			'error'                => \__( 'Error', 'lolacore' ),
			'builderDrafting'      => \__( 'The engineering team is drafting the plugin…', 'lolacore' ),
			'builderStarting'      => \__( 'Starting job...', 'lolacore' ),
			'builderWorking'       => \__( 'Working...', 'lolacore' ),
			'builderBackground'    => \__( 'Building in background...', 'lolacore' ),
			'builderReadyReview'   => \__( 'Your starter plugin is ready for review.', 'lolacore' ),
			'builtPlugin'          => \__( 'Built plugin', 'lolacore' ),
			'technicalDetails'     => \__( 'Technical details', 'lolacore' ),
			'tryAgain'             => \__( 'Try again', 'lolacore' ),
			'builderFailedTitle'   => \__( 'Couldn\'t finish this build', 'lolacore' ),
			'builderRetryFailed'   => \__( 'I couldn\'t start the build again. Refresh the page and try once more.', 'lolacore' ),
			'openPlaygroundAgain'  => \__( 'Open in Playground again', 'lolacore' ),
			'copyLink'             => \__( 'Copy link', 'lolacore' ),
			'copied'               => \__( 'Copied', 'lolacore' ),
			'working'              => \__( 'Working…', 'lolacore' ),
			'done'                 => \__( 'Done.', 'lolacore' ),
			'saveToLibrary'        => \__( 'Save to library', 'lolacore' ),
			'notYet'               => \__( 'Not yet', 'lolacore' ),
			'deliveryUpdateReady'  => \__( 'Your update is ready. Save it when you\'re happy to continue.', 'lolacore' ),
			'deliveryStarterReady' => \__( 'Your starter plugin is ready. It should activate and show the settings you asked for — save it, try it in Playground, and tell me what to refine.', 'lolacore' ),
			'deliveryUpdateTitle'  => \__( 'Your update is ready to test', 'lolacore' ),
			'deliveryStarterTitle' => \__( 'Your starter plugin is ready', 'lolacore' ),
			'renderCardFailed'     => \__( 'The plugin was generated, but I couldn\'t render the review card. Open the Built Plugins library to find it.', 'lolacore' ),
			'loadTestPassed'       => \__( 'Passed', 'lolacore' ),
			'loadTestFailed'       => \__( 'Failed', 'lolacore' ),
			'loadTestSkipped'      => \__( 'Skipped', 'lolacore' ),
			'loadTestLabel'        => \__( 'Load test:', 'lolacore' ),
			'codeReviewLabel'      => \__( 'Code review:', 'lolacore' ),
			'suggestionsOne'       => \__( '1 improvement we can make next', 'lolacore' ),
			/* translators: %d: number of improvement suggestions */
			'suggestionsMany'      => \__( '%d improvements we can make next', 'lolacore' ),
			'eduUpdateLead'        => \__( 'Here\'s the next iteration of your plugin. Test the changes in Playground before installing on your live site.', 'lolacore' ),
			'eduUpdateGuide'       => \__( 'Save when you\'re happy, then tell me what still needs to change.', 'lolacore' ),
			'eduCreateLead'        => \__( 'This is your working first version — it should activate cleanly and include the settings and features you described. Fine-tuning how it behaves on your store is the normal next step in plugin development.', 'lolacore' ),
			'eduCreateGuide'       => \__( 'Save it to your library, test it in Playground, then tell me what to adjust. You set the direction; I\'ll read the code and your site and we\'ll refine it together.', 'lolacore' ),
			'eduHowTitle'          => \__( 'How plugin building works', 'lolacore' ),
			'eduHowBody'           => \__( 'Most plugins start as a working base, then improve with each round of testing and feedback. You\'re the architect — you decide what the plugin should do. I\'m your engineer on this site: I review the code, spot gaps, and help you iterate until it fits how you run your store. Behind the scenes, our development team turns that plan into PHP, JavaScript, and CSS.', 'lolacore' ),
			'buildComplete'        => \__( 'Build complete', 'lolacore' ),
			'readyForReview'       => \__( 'Ready for review.', 'lolacore' ),
			'builderFailedStatus'  => \__( 'I couldn\'t finish this build. Try again or simplify what you\'re asking for.', 'lolacore' ),
			'stillWorkingTitle'    => \__( 'Still working on it', 'lolacore' ),
			'stillWorkingStatus'   => \__( 'This is taking longer than expected. It may still finish in the background — check the library shortly.', 'lolacore' ),
			'tryingAgain'          => \__( 'Trying again...', 'lolacore' ),
			'buildLimitReached'    => \__( 'I\'ve tried this a few times already. Let\'s try a smaller request, or switch to a stronger model in Settings.', 'lolacore' ),
			'builtBlock'           => \__( 'Built block', 'lolacore' ),
			'bbAttestCopy'         => \__( 'Insert the block in the editor and check the front end. When it looks right, install it on your site.', 'lolacore' ),
			'pbAttestCopy'         => \__( 'Check the settings page and the front end. When it looks right, install it on your site.', 'lolacore' ),
			/* translators: %s: name of the built plugin or block */
			'issuePrompt'          => \__( 'I tested "%s" in Playground and something\'s not right: ', 'lolacore' ),
			'bbInstallError'       => \__( 'I could not install the block. Try again from Built Blocks.', 'lolacore' ),
			'bbInstallErrorNetwork'=> \__( 'I could not install the block. Check your connection and try again.', 'lolacore' ),
			'bbInstalled'          => \__( 'I installed the block files on this site.', 'lolacore' ),
			'pbInstallError'       => \__( 'I could not install the plugin. Try again from Built Plugins.', 'lolacore' ),
			'pbInstallErrorNetwork'=> \__( 'I could not install the plugin. Check your connection and try again.', 'lolacore' ),
			'pbInstalled'          => \__( 'I installed the plugin files on this site.', 'lolacore' ),
			'overwriteConfirm'     => \__( 'A copy is already installed. Overwrite it with this library version?', 'lolacore' ),
			'overwriteConfirmTitle' => \__( 'Overwrite installed copy', 'lolacore' ),
			'overwriteConfirmMessagePlugin' => \__(
				'A version is already on this site. I will replace those files. Any active copy will be deactivated first.',
				'lolacore'
			),
			'overwriteConfirmMessageBlock' => \__(
				'A version is already on this site. I will replace those files.',
				'lolacore'
			),
			'overwrite'            => \__( 'Overwrite', 'lolacore' ),
			'openPlugins'          => \__( 'Open Plugins', 'lolacore' ),
			'activatePrompt'       => \__( 'Want me to activate it now?', 'lolacore' ),
			'activateNow'          => \__( 'Activate now', 'lolacore' ),
			'activateFailed'       => \__( 'I could not activate the plugin. Open Plugins and try from there.', 'lolacore' ),
			'activatedDone'        => \__( 'Done. The plugin is active on this site.', 'lolacore' ),
			'attestSaveFailed'     => \__( 'I could not save your Playground check. Try again.', 'lolacore' ),
			'gateFailedHint'       => \__( 'Something did not look right last time. Open Playground again, or tell me what you saw.', 'lolacore' ),
			'gateHintAttested'     => \__( 'You already checked this in Playground. Install it on your live site when you are ready.', 'lolacore' ),
			'gateHintUntested'     => \__( 'Test in Playground before installing on your live site.', 'lolacore' ),
			'openInPlayground'     => \__( 'Open in Playground', 'lolacore' ),
			'installOnMySite'      => \__( 'Install on my site', 'lolacore' ),
			'somethingNotRight'    => \__( 'Something\'s not right', 'lolacore' ),
			'installOnThisSite'    => \__( 'Install on this site', 'lolacore' ),
			'copyThisLink'         => \__( 'Copy this link:', 'lolacore' ),
			'preparingPlayground'  => \__( 'Preparing Playground…', 'lolacore' ),
			'playgroundLinkFailed' => \__( 'Could not generate Playground link.', 'lolacore' ),
			'playgroundLinkFailedNetwork' => \__( 'Could not generate Playground link. Check your connection and try again.', 'lolacore' ),
			'readyToTestPlayground'=> \__( 'Ready to test in Playground', 'lolacore' ),
			'unknown'              => \__( 'Unknown', 'lolacore' ),
			'processingFailed'     => \__( 'Something went wrong and I couldn\'t process that. Try refreshing the page.', 'lolacore' ),
			'rollbackCardTitle'    => \__( 'Roll back plugin version', 'lolacore' ),
			'rollbackReassurance'  => \__( 'Same plugin from WordPress.org — you\'re switching to an earlier release, not removing anything.', 'lolacore' ),
			'rollbackActiveNote'   => \__( 'It\'s active — I\'ll turn it off briefly during the swap, then turn it back on.', 'lolacore' ),
		);
	}
}
