"""
SmartNotes
Generated by Eden via recursive self-improvement
2025-10-27 18:19:22.133972
"""

class SmartNoteManager:
    """A class to manage and organize notes efficiently.
    
    Attributes:
        notes (list): A list of notes, each stored as a dictionary with 'title' and 'content'.
    """

    def __init__(self):
        """Initialize the note manager with an empty list."""
        self.notes = []

    def add_note(self, title: str, content: str) -> None:
        """Add a new note to the system.
        
        Args:
            title (str): The title of the note.
            content (str): The content of the note.
        """
        self.notes.append({'title': title, 'content': content})

    def get_notes(self) -> list:
        """Retrieve all notes in the system.
        
        Returns:
            list: A list of dictionaries, each containing 'title' and 'content'.
        """
        return self.notes.copy()

    def search_by_keyword(self, keyword: str) -> list:
        """Search for notes containing a specific keyword.
        
        Args:
            keyword (str): The keyword to search for in note titles or content.
            
        Returns:
            list: A list of notes that contain the keyword in either title or content.
        """
        results = []
        for note in self.notes:
            if keyword in note['title'] or keyword in note['content']:
                results.append(note)
        return results

    def delete_note(self, title: str) -> None:
        """Delete a note by its title.
        
        Args:
            title (str): The title of the note to be deleted.
            
        Raises:
            ValueError: If no note with the given title exists.
        """
        try:
            index = next(i for i, note in enumerate(self.notes) if note['title'] == title)
            del self.notes[index]
        except StopIteration:
            raise ValueError(f"No note found with title: {title}")

# Example usage:
if __name__ == "__main__":
    # Initialize the note manager
    note_manager = SmartNoteManager()
    
    # Add some notes
    note_manager.add_note("Welcome Message", "Hello, how can I help you today?")
    note_manager.add_note("Meeting Notes", "Discuss project timeline and deliverables.")
    note_manager.add_note("To-Do List", "Complete the documentation by EOD.")
    
    # Search for a keyword
    search_results = note_manager.search_by_keyword("project")
    print("Search results:", search_results)
    
    # Get all notes
    all_notes = note_manager.get_notes()
    print("\nAll notes:")
    for note in all_notes:
        print(f"Title: {note['title']}")
        print(f"Content: {note['content']}\n")
    
    # Delete a note
    try:
        note_manager.delete_note("Welcome Message")
        print("Note 'Welcome Message' deleted successfully.")
    except ValueError as e:
        print(e)