#!/usr/bin/env python3
"""
Memory Configuration - Centralized path configuration
====================================================

This module provides the correct paths for the memory system,
replacing hardcoded paths in the classic modules.
"""

import os
from pathlib import Path

# Import centralized config
import sys
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
from config import MEMORY_DIR

# Get the proper memory directory
def get_memory_base_path():
    """Get the base path for memory storage"""
    # Use the centralized config
    return MEMORY_DIR

# Set the base path
MEMORY_BASE_PATH = get_memory_base_path()

# Ensure subdirectories exist
subdirs = [
    "conversations",
    "memories", 
    "perspectives",
    "recovery",
    "essence",
    "journey"
]

for subdir in subdirs:
    (MEMORY_BASE_PATH / subdir).mkdir(exist_ok=True)

# Export paths
SECURE_JOURNAL_FILE = MEMORY_BASE_PATH / "secure_journal.dat"
SECURE_JOURNAL_SIG = MEMORY_BASE_PATH / "secure_journal.sig"
RECOVERY_LOG_FILE = MEMORY_BASE_PATH / "recovery" / "recovery_log.json"
SYSTEM_HEALTH_FILE = MEMORY_BASE_PATH / "recovery" / "system_health.json"
PERSPECTIVE_LEARNING_FILE = MEMORY_BASE_PATH / "perspectives" / "perspective_learning.json"
LEARNED_PATTERNS_FILE = MEMORY_BASE_PATH / "perspectives" / "learned_patterns.json"
MEMORY_ESSENCE_FILE = MEMORY_BASE_PATH / "essence" / "memory_essence.json"

# Legacy path mapping for compatibility
LEGACY_BASE_PATH = Path(str(MEMORY_DIR))