<?php

/**
 * LolaCore — Centralized Status & Success Messages
 *
 * Every user-facing success, progress, and confirmation string lives here.
 * Lola's voice rules apply: specific outcomes, no filler words, no flattery.
 *
 * @package LolaCore
 * @license GPL-2.0-or-later
 * @since   1.1.2
 */

declare(strict_types=1);

namespace LolaCore\I18n;

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

class StatusMessages {

	// =========================================================================
	// Settings
	// =========================================================================

	public static function settingsSaved(): string {
		return \__( 'Settings saved.', 'lolacore' );
	}

	public static function defaultsRestored(): string {
		return \__( 'Defaults restored.', 'lolacore' );
	}

	public static function domainsUpdated(): string {
		return \__( 'Domains updated.', 'lolacore' );
	}

	public static function safetySaved(): string {
		return \__( 'Safety settings saved.', 'lolacore' );
	}

	/**
	 * Safety interlock: confirmations were re-enabled because no backup plugin is active.
	 */
	public static function safetyInterlockWarning(): string {
		return \__( 'Confirmations were re-enabled because no backup plugin is active. Install a backup solution before disabling confirmations.', 'lolacore' );
	}

	// =========================================================================
	// Maintenance
	// =========================================================================

	public static function rescanComplete(): string {
		return \__( 'Site re-scan complete.', 'lolacore' );
	}

	/**
	 * @param int $imported Number of facts imported.
	 * @param int $skipped  Number of facts skipped.
	 */
	public static function importComplete( int $imported, int $skipped ): string {
		return \sprintf(
			/* translators: 1: Number of imported facts, 2: Number of skipped facts */
			\__( 'Imported %1$d facts (%2$d skipped).', 'lolacore' ),
			$imported,
			$skipped
		);
	}

	/**
	 * @param int $deleted   Number of facts removed.
	 * @param int $remaining Number of facts remaining.
	 */
	public static function compactComplete( int $deleted, int $remaining ): string {
		return \sprintf(
			/* translators: 1: Number of deleted facts, 2: Number of remaining facts */
			\__( 'Compacted memory. Removed %1$d facts, %2$d remaining.', 'lolacore' ),
			$deleted,
			$remaining
		);
	}

	public static function memoryWiped(): string {
		return \__( "Memory wiped. Lola will rebuild her facts as you interact with her.", 'lolacore' );
	}

	// =========================================================================
	// Onboarding (Chat UI)
	// =========================================================================

	/**
	 * Shown when AI provider is not yet configured during onboarding.
	 */
	public static function onboardingNoProvider(): string {
		return \__( "I've scanned your site and have the report ready. To start working together, connect an AI provider in Settings → Connectors. You'll need an API key from OpenAI, Anthropic, or any provider supported by WordPress.", 'lolacore' );
	}

	// =========================================================================
	// Skills
	// =========================================================================

	public static function skillToggled( string $name, bool $enabled ): string {
		return $enabled
			? \sprintf(
				/* translators: %s: skill name */
				\__( 'Skill "%s" enabled.', 'lolacore' ),
				$name
			)
			: \sprintf(
				/* translators: %s: skill name */
				\__( 'Skill "%s" disabled.', 'lolacore' ),
				$name
			);
	}

	public static function skillDeleted( string $name ): string {
		return \sprintf(
			/* translators: %s: skill name */
			\__( 'Skill "%s" deleted.', 'lolacore' ),
			$name
		);
	}

	/**
	 * @param int $count Number of skills found after reload.
	 */
	public static function skillsReloaded( int $count ): string {
		return \sprintf(
			/* translators: %d: number of skills */
			\__( 'Skills reloaded. %d skills found.', 'lolacore' ),
			$count
		);
	}

	public static function skillImported( string $name ): string {
		return \sprintf(
			/* translators: %s: skill name */
			\__( 'Skill "%s" imported as draft. Review and activate when ready.', 'lolacore' ),
			$name
		);
	}

	public static function skillUpdated( string $name ): string {
		return \sprintf(
			/* translators: %s: skill name */
			\__( 'Skill "%s" updated.', 'lolacore' ),
			$name
		);
	}

	public static function skillActivated( string $name ): string {
		return \sprintf(
			/* translators: %s: skill name */
			\__( 'Skill "%s" activated.', 'lolacore' ),
			$name
		);
	}

	public static function skillParamsSaved(): string {
		return \__( 'Skill parameters saved.', 'lolacore' );
	}

	public static function skillDefaultsRestored(): string {
		return \__( 'Skill parameters restored to defaults.', 'lolacore' );
	}

	public static function skillsSectionToggled( bool $enabled ): string {
		return $enabled
			? \__( 'Skills system enabled. Built-in skills are now active.', 'lolacore' )
			: \__( 'Skills system disabled. Lola will not load any skill until you re-enable it.', 'lolacore' );
	}

	// =========================================================================
	// Playbooks
	// =========================================================================

	public static function playbookToggled( string $slug, bool $enabled ): string {
		return $enabled
			? \sprintf(
				/* translators: %s: playbook slug */
				\__( 'Playbook "%s" activated.', 'lolacore' ),
				$slug
			)
			: \sprintf(
				/* translators: %s: playbook slug */
				\__( 'Playbook "%s" deactivated.', 'lolacore' ),
				$slug
			);
	}

	public static function playbookDeleted( string $slug ): string {
		return \sprintf(
			/* translators: %s: playbook slug */
			\__( 'Playbook "%s" deleted.', 'lolacore' ),
			$slug
		);
	}

	public static function playbookSaved( string $slug ): string {
		return \sprintf(
			/* translators: %s: playbook slug */
			\__( 'Playbook "%s" saved.', 'lolacore' ),
			$slug
		);
	}

	public static function playbookCreated( string $slug ): string {
		return \sprintf(
			/* translators: %s: playbook slug */
			\__( 'Playbook "%s" created (inactive). Activate it when you are ready.', 'lolacore' ),
			$slug
		);
	}

	/**
	 * @param int $count Number of playbooks found after reload.
	 */
	public static function playbooksReloaded( int $count ): string {
		return \sprintf(
			/* translators: %d: number of playbooks */
			\__( 'Playbooks reloaded. %d playbooks found.', 'lolacore' ),
			$count
		);
	}

	// =========================================================================
	// Licensing
	// =========================================================================

	public static function licenseActivated(): string {
		return \__( 'License activated.', 'lolacore' );
	}

	public static function licenseDeactivated(): string {
		return \__( 'License deactivated.', 'lolacore' );
	}
}
