use std::borrow::Cow;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{Pool, PoolSlug};
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct PoolInfo {
#[schemars(example = &"Foundry USA")]
pub name: Cow<'static, str>,
pub slug: PoolSlug,
#[schemars(example = 44)]
pub unique_id: u8,
}
impl From<&'static Pool> for PoolInfo {
fn from(pool: &'static Pool) -> Self {
Self {
name: Cow::Borrowed(pool.name),
slug: pool.slug(),
unique_id: pool.mempool_unique_id(),
}
}
}