/*
 * Cube.js
 *
 * Cube.js Swagger Schema
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 *
 * Hand-maintained: generic over the result `data` payload type. See
 * `v1_load_result.rs` for the rationale.
 */

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

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct V1LoadResponse<D = models::V1LoadResultDataRow> {
    #[serde(rename = "pivotQuery", skip_serializing_if = "Option::is_none")]
    pub pivot_query: Option<serde_json::Value>,
    #[serde(rename = "slowQuery", skip_serializing_if = "Option::is_none")]
    pub slow_query: Option<bool>,
    #[serde(rename = "queryType", skip_serializing_if = "Option::is_none")]
    pub query_type: Option<String>,
    #[serde(rename = "results")]
    pub results: Vec<models::V1LoadResult<D>>,
}

impl<D> Default for V1LoadResponse<D> {
    fn default() -> Self {
        Self {
            pivot_query: None,
            slow_query: None,
            query_type: None,
            results: Vec::new(),
        }
    }
}

impl<D> V1LoadResponse<D> {
    pub fn new(results: Vec<models::V1LoadResult<D>>) -> V1LoadResponse<D> {
        V1LoadResponse {
            pivot_query: None,
            slow_query: None,
            query_type: None,
            results,
        }
    }
}
