<?php
/**
 * Settings V2: MEMANTO.
 *
 * @package WP_Agentic_Writer
 */

if (!defined("ABSPATH")) {
    exit();
} ?>
<div class="section-head"><div><p class="eyebrow"><?php esc_html_e(
    "Memory",
    "wp-agentic-writer",
); ?></p><h2><?php esc_html_e(
    "MEMANTO Context Keeper",
    "wp-agentic-writer",
); ?></h2><p><?php esc_html_e(
    "Optional persistent memory for agentic writing sessions.",
    "wp-agentic-writer",
); ?></p></div><span class="status <?php echo $memanto_enabled
    ? "connected"
    : "warn"; ?>"><?php echo $memanto_enabled
    ? esc_html__("Enabled", "wp-agentic-writer")
    : esc_html__("Optional", "wp-agentic-writer"); ?></span></div>

<div class="panel">
	<div class="panel-head"><div class="panel-title"><h3><?php esc_html_e(
     "Integration",
     "wp-agentic-writer",
 ); ?></h3><p><?php esc_html_e(
    "Connect your MEMANTO instance and Moorcheh key.",
    "wp-agentic-writer",
); ?></p></div><button type="button" class="btn btn-small" id="wpaw-test-memanto"><?php esc_html_e(
    "Test connection",
    "wp-agentic-writer",
); ?></button></div>
	<div class="panel-body">
		<label class="switch-row"><input type="checkbox" name="wp_agentic_writer_settings[memanto_enabled]" value="1" <?php checked(
      $memanto_enabled,
  ); ?>><span class="switch"></span><span><?php esc_html_e(
    "Enable MEMANTO",
    "wp-agentic-writer",
); ?></span></label>

		<div class="grid-2" style="margin-top:14px">
			<div class="field">
				<label for="memanto_url"><?php esc_html_e(
        "Instance URL",
        "wp-agentic-writer",
    ); ?></label>
				<input class="field-control" type="url" id="memanto_url" name="wp_agentic_writer_settings[memanto_url]" value="<?php echo esc_attr(
        $memanto_url,
    ); ?>" placeholder="https://your-memanto-instance.com">
			</div>
			<div class="field">
				<label for="memanto_license_key"><?php esc_html_e(
        "Instance license key",
        "wp-agentic-writer",
    ); ?></label>
				<input class="field-control" type="text" id="memanto_license_key" name="wp_agentic_writer_settings[memanto_license_key]" value="<?php echo esc_attr(
        $memanto_license_key,
    ); ?>">
			</div>
		</div>

		<div class="field" style="margin-top:14px">
			<label for="memanto_moorcheh_key"><?php esc_html_e(
       "Moorcheh API key",
       "wp-agentic-writer",
   ); ?></label>
			<div class="password-row">
				<input class="field-control" type="password" id="memanto_moorcheh_key" name="wp_agentic_writer_settings[memanto_moorcheh_key]" value="<?php echo esc_attr(
        $memanto_moorcheh_key,
    ); ?>">
				<button type="button" class="btn" data-aw2-toggle-password="#memanto_moorcheh_key"><?php esc_html_e(
        "Show",
        "wp-agentic-writer",
    ); ?></button>
			</div>
		</div>
	</div>
</div>

<div class="panel"><div class="panel-head"><div class="panel-title"><h3><?php esc_html_e(
    "What MEMANTO does",
    "wp-agentic-writer",
); ?></h3><p><?php esc_html_e(
    "Keeps preferences and context across writing sessions.",
    "wp-agentic-writer",
); ?></p></div></div><div class="panel-body grid-3"><div class="guide-card"><h3><?php esc_html_e(
    "Remembers context",
    "wp-agentic-writer",
); ?></h3><p class="help"><?php esc_html_e(
    "Carry preferences across posts and refreshes.",
    "wp-agentic-writer",
); ?></p></div><div class="guide-card"><h3><?php esc_html_e(
    "Reduces tokens",
    "wp-agentic-writer",
); ?></h3><p class="help"><?php esc_html_e(
    "Recall relevant memory instead of resending all context.",
    "wp-agentic-writer",
); ?></p></div><div class="guide-card"><h3><?php esc_html_e(
    "Optional",
    "wp-agentic-writer",
); ?></h3><p class="help"><?php esc_html_e(
    "Agentic Writer works without MEMANTO.",
    "wp-agentic-writer",
); ?></p></div></div></div>
