made_core/value_objects/
claim_text.rs1use serde::{Deserialize, Serialize};
2
3use crate::error::DomainError;
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(transparent)]
8pub struct ClaimText(String);
9
10impl ClaimText {
11 pub fn new(raw: impl Into<String>) -> Result<Self, DomainError> {
12 let raw = raw.into();
13 if raw.trim().is_empty() {
14 return Err(DomainError::EmptyField {
15 field: "evidence_support.claim",
16 });
17 }
18 Ok(Self(raw))
19 }
20
21 #[must_use]
22 pub fn as_str(&self) -> &str {
23 &self.0
24 }
25}