"""
MeetingMinutesGenerator
Generated by Eden via recursive self-improvement
2025-10-27 19:08:15.039522
"""

class MeetingMinutes:
    """
    A class to generate structured meeting minutes from a transcript.
    
    Attributes:
        participants (list): List of participants in the meeting.
        transcript (str): The full transcript of the meeting.
        key_points (list): Extracted key points from the discussion.
        action_items (list): Extracted action items with owners and deadlines.
    """

    def __init__(self, participants: list, transcript: str):
        """
        Initialize the MeetingMinutes object.

        Args:
            participants (list): List of participant names.
            transcript (str): The full transcript of the meeting.
        """
        self.participants = participants
        self.transcript = transcript.split('\n')
        self.key_points = []
        self.action_items = []

    def extract_key_points(self) -> list:
        """
        Extracts key discussion points from the transcript.

        Returns:
            list: A list of key points identified in the meeting.
        """
        verbs = ['discuss', 'review', 'address', 'consider', 'plan']
        for line in self.transcript:
            if any(verb in line.lower() for verb in verbs):
                point = f"{line.split(':')[0].strip()} {line.split(':')[1].split('.')[0].strip('.')}"
                self.key_points.append(point)
        return self.key_points

    def assign_action_items(self) -> list:
        """
        Identifies action items and assigns them to participants with deadlines.

        Returns:
            list: A list of action items with owners and deadlines.
        """
        for line in self.transcript:
            if "action item" in line.lower():
                owner = line.split("owner:")[1].split(",")[0].strip()
                deadline = line.split("deadline:")[1].split(".")[0].strip()
                task = f"{line.split('task:')[1].split(' owner')[0].strip()}"
                self.action_items.append({
                    "task": task,
                    "owner": owner,
                    "deadline": deadline
                })
        return self.action_items

    def summarize(self, concise: bool = True) -> str:
        """
        Generates a summary of the meeting minutes.

        Args:
            concise (bool): Whether to return a concise or detailed summary.
                           Defaults to True.

        Returns:
            str: The summarized meeting minutes.
        """
        key_points = self.extract_key_points()
        action_items = self.assign_action_items()

        if concise:
            summary = f"Meeting Summary:\n- Key Points: {'; '.join(key_points)}\n"
            "Action Items:\n"
            f"{'; '.join([f'{item["task"]}' for item in action_items])}\n"
            f"Owners and Deadlines:\n"
            f"{'; '.join([f'{item['owner']}: {item['deadline']}' for item in action_items])}"
        else:
            summary = f"Meeting Summary:\nParticipants: {', '.join(self.participants)}\n\nKey Points:\n"
            "\n".join([f"- {point}" for point in key_points]) + "\n\nAction Items:\n"
            "\n".join([f"- {item['task']}; Owner: {item['owner']}, Deadline: {item['deadline']}"
                      for item in action_items])
        return summary

# Example usage:
if __name__ == "__main__":
    participants = ["Alice", "Bob", "Charlie"]
    transcript = """Meeting Transcript:
- Discuss project timeline. Action item: Review Gantt chart by Friday.
- Charlie will handle the UI component by next week.
- Any questions about the deliverables?"""

    meeting = MeetingMinutes(participants, transcript)
    print(meeting.summarize())