use chrono::NaiveDate;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, sqlx::Type)]
#[sqlx(type_name = "governmentlevel", rename_all = "lowercase")]
pub enum GovernmentLevel {
Unknown,
SpecialDistrict,
Municipal,
County,
State,
Federal,
International,
Global,
Interplanetary,
}
impl From<()> for GovernmentLevel {
fn from(_: ()) -> Self {
Self::Unknown
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, sqlx::Type)]
#[sqlx(type_name = "branch")]
pub enum Branch {
Unknown,
Executive,
Legislative,
Judicial,
}
impl From<()> for Branch {
fn from(_: ()) -> Self {
Self::Unknown
}
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, sqlx::Type)]
pub struct Term {
pub branch: Branch,
pub branch_sources: Vec<String>,
pub end_date: Option<NaiveDate>,
pub end_date_sources: Vec<String>,
pub id: Uuid,
pub level: GovernmentLevel,
pub level_sources: Vec<String>,
pub location: String,
pub location_sources: Vec<String>,
pub office_title: String,
pub office_title_sources: Vec<String>,
pub parent_id: Uuid,
pub political_party: String,
pub political_party_sources: Vec<String>,
pub session_number: Option<i32>,
pub session_number_sources: Vec<String>,
pub start_date: NaiveDate,
pub start_date_sources: Vec<String>,
}