use heromodels_core::BaseModelData; use heromodels_derive::model; use serde::{Deserialize, Serialize}; /// Represents a comment on a model #[derive(Debug, Clone, Serialize, Deserialize)] #[model] pub struct Comment { pub base_data: BaseModelData, #[index] pub user_id: u32, pub content: String, } impl Comment { /// Create a new comment with auto-generated ID pub fn new() -> Self { Self { base_data: BaseModelData::new(), user_id: 0, content: String::new(), } } /// Set the user ID pub fn user_id(mut self, id: u32) -> Self { self.user_id = id; self } /// Set the content pub fn content(mut self, content: impl ToString) -> Self { self.content = content.to_string(); self } }