use tonic::Code;
use crate::{
Category, Exposure,
error::{DecodeError, EncodeError},
};
pub trait Aerro: std::error::Error + Send + Sync + 'static {
const TYPE_IDS: &'static [&'static str];
fn type_id(&self) -> &'static str;
fn category(&self) -> Category;
fn code(&self) -> Code;
fn exposure(&self) -> Exposure {
self.category().default_exposure()
}
fn encode_payload(&self, route: Exposure, buf: &mut Vec<u8>) -> Result<(), EncodeError>;
fn decode_payload(type_id: &str, bytes: &[u8]) -> Result<Self, DecodeError>
where
Self: Sized;
}