1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use serde::{Deserialize, Serialize};
use sp_std::prelude::*;

use crate::parquet::base::ParquetBaseType;

use crate::parquet::{
	numeric::ParquetNumericType, string::ParquetStringType, temporal::ParquetTemporalType,
};

/// Encapsulates label types for Parquet
#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ParquetType {
	/// Base types (bool, int, etc)
	BaseType(ParquetBaseType),
	/// Strings
	StringType(ParquetStringType),
	/// Numbers
	NumericType(ParquetNumericType),
	/// Time
	TemporalType(ParquetTemporalType),
}

impl Default for ParquetType {
	fn default() -> Self {
		Self::BaseType(ParquetBaseType::Boolean)
	}
}