use core::any::Any;
use crate::{edge::Edge, triad::Triad};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(enum_display::EnumDisplay)]
pub enum Need
{
#[display("Attachment/\"I need freedom\"")]
Attachment,
#[display("Frustration/\"I need control\"")]
Frustration,
#[display("Rejection/\"I need love\"")]
Rejection
}
impl Need
{
pub const fn all() -> [Self; 3]
{
[Self::Attachment, Self::Frustration, Self::Rejection]
}
}
impl Triad for Need
{
fn as_any(&self) -> &dyn Any
{
self
}
fn equals(&self, other: &dyn Triad) -> bool
{
other.as_any().downcast_ref().is_some_and(|other| self == other)
}
fn edges(&self) -> &'static [Edge; 3]
{
match self
{
Need::Attachment => &[Edge::Repression, Edge::Paranoia, Edge::Rest], Need::Frustration => &[Edge::Recovery, Edge::Rejection, Edge::Disorganization], Need::Rejection => &[Edge::Association, Edge::Catatonia, Edge::Action], }
}
fn expression(&self) -> &'static str
{
match self
{
Need::Attachment => "I need freedom",
Need::Frustration => "I need control",
Need::Rejection => "I need love",
}
}
fn reflection(&self) -> &'static str
{
match self
{
Need::Attachment => "you crave freedom",
Need::Frustration => "you crave control",
Need::Rejection => "you crave love"
}
}
}