use thiserror::Error;
use crate::schema::SchemaId;
#[derive(Error, Debug)]
pub enum SchemaIdError {
#[error("malformed schema id `{0}`: {1}")]
MalformedSchemaId(String, String),
#[error("application schema id is missing a name: {0}")]
MissingApplicationSchemaName(String),
#[error("unsupported system schema: {0}")]
UnknownSystemSchema(String),
#[error("encountered invalid hash while parsing application schema id: {0}")]
HashError(#[from] crate::hash::error::HashError),
#[error("encountered invalid document view id while parsing application schema id: {0}")]
DocumentViewIdError(#[from] crate::document::error::DocumentViewIdError),
#[error("encountered invalid hash while parsing application schema id: {0}")]
OperationIdError(#[from] crate::operation::error::OperationIdError),
}
#[derive(Error, Debug)]
pub enum SchemaError {
#[error("invalid fields found for this schema")]
InvalidFields,
#[error("dynamic redefinition of system schema {0}, use `Schema::get_system` instead")]
DynamicSystemSchema(SchemaId),
#[error(transparent)]
SchemaIdError(#[from] SchemaIdError),
}
#[derive(Error, Debug)]
pub enum FieldTypeError {
#[error("invalid field type '{0}'")]
InvalidFieldType(String),
#[error(transparent)]
RelationSchemaReference(#[from] SchemaIdError),
}