use std::sync::OnceLock;
use num_bigint::BigUint;
use crate::codec::{Baseh, DecodeOptions, DecodeResult, InspectResult, ValidateOutcome};
use crate::error::BasehError;
use crate::profiles::baseh_expandable_v1;
static DEFAULT: OnceLock<Baseh> = OnceLock::new();
fn default() -> &'static Baseh {
DEFAULT.get_or_init(|| {
Baseh::new(baseh_expandable_v1()).expect("the frozen baseh-expandable-v1 profile is valid")
})
}
pub fn encode(id: &BigUint) -> Result<String, BasehError> {
default().encode(id)
}
pub fn decode(code: &str) -> Result<DecodeResult, BasehError> {
default().decode(code, &DecodeOptions::default())
}
pub fn inspect(input: &str) -> InspectResult {
default().inspect(input)
}
pub fn validate(code: &str) -> ValidateOutcome {
default().validate(code, &DecodeOptions::default())
}