/*
 * Hotdata API
 *
 * Powerful data platform API for datasets, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// IndexInfoResponse : Result payload for a `create_index` job, and response for index endpoints.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct IndexInfoResponse {
    #[serde(rename = "columns")]
    pub columns: Vec<String>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "index_name")]
    pub index_name: String,
    #[serde(rename = "index_type")]
    pub index_type: String,
    /// Distance metric this index was built with. Only present for vector indexes.
    #[serde(
        rename = "metric",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub metric: Option<Option<String>>,
    #[serde(rename = "status")]
    pub status: models::IndexStatus,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl IndexInfoResponse {
    /// Result payload for a `create_index` job, and response for index endpoints.
    pub fn new(
        columns: Vec<String>,
        created_at: String,
        index_name: String,
        index_type: String,
        status: models::IndexStatus,
        updated_at: String,
    ) -> IndexInfoResponse {
        IndexInfoResponse {
            columns,
            created_at,
            index_name,
            index_type,
            metric: None,
            status,
            updated_at,
        }
    }
}
