use serde::{Deserialize, Serialize};
use super::props_schema::PropsSchema;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct PageSchema {
props: PropsSchema,
}
impl PageSchema {
#[must_use]
pub fn new(props: PropsSchema) -> Self {
Self { props }
}
#[must_use]
pub fn props(&self) -> &PropsSchema {
&self.props
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::inertia::contracts::ContractType;
#[test]
fn carries_the_props_it_was_built_from() {
let props = PropsSchema::new().required("name", ContractType::string());
let page = PageSchema::new(props.clone());
assert_eq!(page.props(), &props);
}
}