from pydantic import BaseModel


class Norm(BaseModel):
    """
    Represents a behavioral norm.

    :ivar id: Unique identifier.
    :ivar label: Human-readable label.
    :ivar norm: The actual norm text describing the behavior.
    """

    id: str
    label: str
    norm: str


class Goal(BaseModel):
    """
    Represents an objective to be achieved.

    :ivar id: Unique identifier.
    :ivar label: Human-readable label.
    :ivar description: Detailed description of the goal.
    :ivar achieved: Status flag indicating if the goal has been met.
    """

    id: str
    label: str
    description: str
    achieved: bool


class TriggerKeyword(BaseModel):
    id: str
    keyword: str


class KeywordTrigger(BaseModel):
    id: str
    label: str
    type: str
    keywords: list[TriggerKeyword]


class Phase(BaseModel):
    """
    A distinct phase within a program, containing norms, goals, and triggers.

    :ivar id: Unique identifier.
    :ivar label: Human-readable label.
    :ivar norms: List of norms active in this phase.
    :ivar goals: List of goals to pursue in this phase.
    :ivar triggers: List of triggers that define transitions out of this phase.
    """

    id: str
    label: str
    norms: list[Norm]
    goals: list[Goal]
    triggers: list[KeywordTrigger]


class Program(BaseModel):
    """
    Represents a complete interaction program, consisting of a sequence or set of phases.

    :ivar phases: The list of phases that make up the program.
    """

    phases: list[Phase]
