use crate::error::Result;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Schema {
pub ver: String,
pub id: String,
pub name: String,
pub version: String,
#[serde(rename(deserialize = "attrNames"))]
pub attr_names: Vec<String>,
#[serde(rename(deserialize = "seqNo"))]
pub seq_no: Option<i32>,
}
#[derive(Debug, Serialize)]
pub struct SchemaCreateOptions {
pub name: String,
pub version: String,
pub attributes: Vec<String>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct SchemasGetAllResponse {
pub schema_ids: Vec<String>,
}
#[async_trait]
pub trait SchemaModule {
async fn create(&self, options: SchemaCreateOptions) -> Result<Schema>;
async fn get_by_id(&self, id: String) -> Result<Schema>;
async fn get_all(&self) -> Result<SchemasGetAllResponse>;
}