"""
EmailAccountManager
Generated by Eden via recursive self-improvement
2025-11-01 05:26:04.870759
"""

class EmailAccountManager:
    """
    A class to manage multiple email accounts through a single interface.
    
    Attributes:
        accounts (dict): A dictionary where keys are account names and values are the respective Gmail usernames.
        
    Methods:
        add_account: Adds an email account to the manager.
        get_inbox: Retrieves emails from a specific inbox.
        send_email: Sends an email using the specified account.
    """
    
    def __init__(self):
        self.accounts = {}
        
    def add_account(self, name, username):
        """
        Add an email account with a given name and username.

        Parameters:
            name (str): The name of the account for easy reference.
            username (str): The Gmail username associated with this account.
        """
        if username in self.accounts.values():
            raise ValueError("Username is already taken.")
        
        self.accounts[name] = username
        
    def get_inbox(self, name):
        """
        Retrieve emails from the inbox of a specific account.

        Parameters:
            name (str): The name of the account whose inbox to retrieve emails from.
            
        Returns:
            list: A list of email messages in the specified inbox.
        """
        
        if name not in self.accounts:
            raise ValueError("Account does not exist.")
        
        # Simulate fetching emails
        emails = ["Email 1", "Email 2"]  # Replace with actual email retrieval logic
        
        return emails
    
    def send_email(self, sender_name, recipient, subject, body):
        """
        Send an email from a specific account.

        Parameters:
            sender_name (str): The name of the account to use as the sender.
            recipient (str): The email address of the recipient.
            subject (str): The subject line of the email.
            body (str): The content of the email body.
            
        Returns:
            str: Confirmation message indicating successful or unsuccessful sending.
        """
        
        if sender_name not in self.accounts:
            raise ValueError("Account does not exist.")
        
        # Simulate sending an email
        confirmation = "Email sent successfully."  # Replace with actual email sending logic
        
        return confirmation


# Example usage
email_manager = EmailAccountManager()
email_manager.add_account("Personal", "personal@example.com")
email_manager.add_account("Work", "work@example.com")

print(email_manager.get_inbox("Personal"))
print(email_manager.send_email("Work", "recipient@example.com", "Test Subject", "This is a test email."))