use amplify::confinement::Confined;
use strict_types::TypeSystem;
use crate::containers::{ContainerVer, Kit, ValidKit};
use crate::contract::ContractData;
use crate::persistence::ContractStateRead;
use crate::validation::Scripts;
use crate::Schema;
pub trait SchemaWrapper<S: ContractStateRead> {
fn with(data: ContractData<S>) -> Self;
}
pub trait IssuerWrapper {
type Wrapper<S: ContractStateRead>: SchemaWrapper<S>;
fn schema() -> Schema;
fn types() -> TypeSystem;
fn scripts() -> Scripts;
fn kit() -> ValidKit {
let kit = Kit {
version: ContainerVer::V0,
schemata: tiny_bset![Self::schema()],
types: Self::types(),
scripts: Confined::from_iter_checked(Self::scripts().release().into_values()),
};
kit.validate().expect("invalid construction")
}
}