use thiserror::Error;
use crate::misc::RawByteStr;
use crate::schema::xs::AttributeType;
use crate::schema::{Namespace, NamespacePrefix};
use crate::types::Ident;
#[derive(Debug, Error)]
pub enum Error {
#[error("Type has already been defined: {0}!")]
TypeAlreadyDefined(Ident),
#[error("Expected dynamic element: {0}!")]
ExpectedDynamicElement(Ident),
#[error("Unknown type: {0}!")]
UnknownType(Ident),
#[error("Unknown element: {0}!")]
UnknownElement(Ident),
#[error("Unknown attribute: {0}!")]
UnknownAttribute(String),
#[error("Unknown namespace: {0}!")]
UnknownNamespace(Namespace),
#[error("Unknown namespace prefix: {0}!")]
UnknownNamespacePrefix(NamespacePrefix),
#[error("Invalid value for `{0}`!")]
InvalidValue(&'static str),
#[error("Invalid local name `{0}`!")]
InvalidLocalName(RawByteStr),
#[error("Group is missing the `ref` attribute!")]
GroupMissingRef,
#[error("Attribute group is missing the `ref` attribute!")]
AttributeGroupMissingRef,
#[error("Invalid attribute reference: {0:#?}!")]
InvalidAttributeReference(Box<AttributeType>),
#[error("Unable to create type information!")]
NoType,
#[error("Expected group type!")]
ExpectedGroupType,
}