use super::codec::{EncodeError, Value};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TypeRead<'a> {
pub code: Option<&'a str>,
pub profiles: Vec<&'a str>,
pub target_profiles: Vec<&'a str>,
pub aggregation: Vec<&'a str>,
pub versioning: Option<&'a str>,
pub regex: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BindingRead<'a> {
pub strength: Option<&'a str>,
pub value_set: Option<&'a str>,
pub max_value_set: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConstraintRead<'a> {
pub key: Option<&'a str>,
pub severity: Option<&'a str>,
pub human: Option<&'a str>,
pub expression: Option<&'a str>,
pub xpath: Option<&'a str>,
pub source: Option<&'a str>,
pub best_practice: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DiscriminatorRead<'a> {
pub kind: Option<&'a str>,
pub path: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SlicingRead<'a> {
pub discriminators: Vec<DiscriminatorRead<'a>>,
pub description: Option<&'a str>,
pub ordered: Option<bool>,
pub rules: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChoiceValue {
pub suffix: &'static str,
pub value: Option<Value>,
pub element: Option<Value>,
}
pub trait ElementDefinitionRead {
fn element_id(&self) -> Option<&str>;
fn path(&self) -> Option<&str>;
fn slice_name(&self) -> Option<&str>;
fn min(&self) -> Option<u32>;
fn max(&self) -> Option<&str>;
fn max_length(&self) -> Option<i32>;
fn is_modifier(&self) -> Option<bool>;
fn content_reference(&self) -> Option<&str>;
fn types(&self) -> Vec<TypeRead<'_>>;
fn binding(&self) -> Option<BindingRead<'_>>;
fn constraints(&self) -> Vec<ConstraintRead<'_>>;
fn slicing(&self) -> Option<SlicingRead<'_>>;
fn fixed(&self) -> Result<Option<ChoiceValue>, EncodeError>;
fn pattern(&self) -> Result<Option<ChoiceValue>, EncodeError>;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ContextRead<'a> {
pub kind: Option<&'a str>,
pub expression: Option<&'a str>,
}
pub trait StructureDefinitionRead {
type Element: ElementDefinitionRead;
fn url(&self) -> Option<&str>;
fn version(&self) -> Option<&str>;
fn type_name(&self) -> Option<&str>;
fn base_definition(&self) -> Option<&str>;
fn kind(&self) -> Option<&str>;
fn is_abstract(&self) -> Option<bool>;
fn derivation(&self) -> Option<&str>;
fn snapshot(&self) -> Option<&[Self::Element]>;
fn contexts(&self) -> Vec<ContextRead<'_>>;
fn context_invariants(&self) -> Vec<&str>;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FilterRead<'a> {
pub property: Option<&'a str>,
pub op: Option<&'a str>,
pub value: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct IncludeRead<'a> {
pub system: Option<&'a str>,
pub version: Option<&'a str>,
pub concepts: Vec<&'a str>,
pub filters: Vec<FilterRead<'a>>,
pub value_sets: Vec<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ComposeRead<'a> {
pub inactive: Option<bool>,
pub includes: Vec<IncludeRead<'a>>,
pub excludes: Vec<IncludeRead<'a>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ExpansionRead<'a, C> {
pub total: Option<i32>,
pub offset: Option<i32>,
pub contains: &'a [C],
}
pub trait ValueSetRead {
type Contains: ContainsRead;
fn compose(&self) -> Option<ComposeRead<'_>>;
fn expansion(&self) -> Option<ExpansionRead<'_, Self::Contains>>;
}
pub trait ContainsRead: Sized {
fn system(&self) -> Option<&str>;
fn version(&self) -> Option<&str>;
fn code(&self) -> Option<&str>;
fn is_abstract(&self) -> Option<bool>;
fn contains(&self) -> &[Self];
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PropertyRead<'a> {
pub code: Option<&'a str>,
pub uri: Option<&'a str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConceptPropertyRead<'a> {
pub code: Option<&'a str>,
pub value: Option<ChoiceValue>,
}
pub trait CodeSystemRead {
type Concept: ConceptRead;
fn content(&self) -> Option<&str>;
fn hierarchy_meaning(&self) -> Option<&str>;
fn case_sensitive(&self) -> Option<bool>;
fn properties(&self) -> Vec<PropertyRead<'_>>;
fn concepts(&self) -> &[Self::Concept];
}
pub trait ConceptRead: Sized {
fn code(&self) -> Option<&str>;
fn display(&self) -> Option<&str>;
fn designations(&self) -> Vec<&str>;
fn properties(&self) -> Result<Vec<ConceptPropertyRead<'_>>, EncodeError>;
fn concepts(&self) -> &[Self];
}