use std::collections::HashSet;

use crate::database::schema::Schema;
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct Type {
  pub id: String,
  pub r#type: String,
  pub name: String,
  pub module: String,
  pub source: String,
  #[serde(default)]
  pub historical: bool,
  #[serde(default)]
  pub sensitive: bool,
  #[serde(default)]
  pub ownable: bool,
  pub longevity: Option<i32>,
  #[serde(default)]
  pub hierarchy: Vec<String>,
  #[serde(default)]
  pub variations: HashSet<String>,
  #[serde(default)]
  pub relationship: bool,
  #[serde(default)]
  pub fields: Vec<String>,
  pub grouped_fields: Option<Value>,
  #[serde(default)]
  pub lookup_fields: Vec<String>,
  #[serde(default)]
  pub null_fields: Vec<String>,
  #[serde(default)]
  pub default_fields: Vec<String>,
  pub field_types: Option<Value>,
  #[serde(default)]
  pub schemas: Vec<Schema>,
}
