use super::{DeletionProtection, IndexModelSpec, IndexModelStatus, Metric};
use crate::openapi::models::index_model::IndexModel as OpenApiIndexModel;
#[derive(Clone, Default, Debug, PartialEq)]
pub struct IndexModel {
pub name: String,
pub dimension: i32,
pub metric: Metric,
pub host: String,
pub deletion_protection: Option<DeletionProtection>,
pub spec: IndexModelSpec,
pub status: IndexModelStatus,
}
impl From<OpenApiIndexModel> for IndexModel {
fn from(openapi_index_model: OpenApiIndexModel) -> Self {
IndexModel {
name: openapi_index_model.name,
dimension: openapi_index_model.dimension,
metric: openapi_index_model.metric.into(),
host: openapi_index_model.host,
deletion_protection: openapi_index_model.deletion_protection,
spec: *openapi_index_model.spec,
status: *openapi_index_model.status,
}
}
}