use crate::model::agent::view::AgentTypeView;
use crate::model::text::fmt::{
format_message_highlight, log_table, FieldsBuilder, MessageWithFields, TextView,
};
use golem_common::model::agent::RegisteredAgentType;
impl MessageWithFields for AgentTypeView {
fn message(&self) -> String {
format!(
"Got deployed agent type: {} ",
format_message_highlight(&self.agent_type)
)
}
fn fields(&self) -> Vec<(String, String)> {
let mut fields = FieldsBuilder::new();
fields.field("Agent type", &self.agent_type);
fields.field("Constructor", &self.constructor);
fields.field("Description", &self.description);
fields.build()
}
}
impl From<&RegisteredAgentType> for AgentTypeView {
fn from(value: &RegisteredAgentType) -> Self {
AgentTypeView::new(value)
}
}
impl TextView for Vec<RegisteredAgentType> {
fn log(&self) {
log_table::<_, AgentTypeView>(self);
}
}