use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
pub use maestro_graphql_schema::PageInfo;
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PartyId {
pub ipi: Option<i64>,
pub isni: Option<String>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Creator {
pub party_id: PartyId,
pub role: String,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Date {
pub year: i32,
pub month: i32,
pub day: i32,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MusicalWork {
pub id: i64,
pub provider: String,
pub hash: String,
pub data_cost: String,
pub registered_at_block: i64,
pub registered_at_timestamp: Option<DateTime<Utc>>,
pub iswc: String,
pub title: String,
pub creation_year: Option<i32>,
pub instrumental: Option<bool>,
pub language: Option<String>,
pub bpm: Option<i32>,
pub key: Option<String>,
pub work_type: Option<String>,
pub creators: Vec<Creator>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MusicalWorkEdge {
pub node: MusicalWork,
pub cursor: String,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MusicalWorkConnection {
pub edges: Vec<MusicalWorkEdge>,
pub page_info: PageInfo,
pub total_count: Option<i64>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Recording {
pub id: i64,
pub provider: String,
pub hash: String,
pub data_cost: String,
pub registered_at_block: i64,
pub registered_at_timestamp: Option<DateTime<Utc>>,
pub isrc: String,
pub musical_work_id: i64,
pub artist: PartyId,
pub title: String,
pub recording_year: Option<i32>,
pub duration: Option<i32>,
pub bpm: Option<i32>,
pub key: Option<String>,
pub version: Option<String>,
pub genres: Vec<String>,
pub producers: Vec<PartyId>,
pub performers: Vec<PartyId>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordingEdge {
pub node: Recording,
pub cursor: String,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordingConnection {
pub edges: Vec<RecordingEdge>,
pub page_info: PageInfo,
pub total_count: Option<i64>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Release {
pub id: i64,
pub provider: String,
pub hash: String,
pub data_cost: String,
pub registered_at_block: i64,
pub registered_at_timestamp: Option<DateTime<Utc>>,
pub ean_upc: String,
pub creator: PartyId,
pub title: String,
pub release_type: String,
pub format: String,
pub packaging: String,
pub status: String,
pub date: Date,
pub country: String,
pub recording_ids: Vec<i64>,
pub distributor_name: String,
pub manufacturer_name: String,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseEdge {
pub node: Release,
pub cursor: String,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseConnection {
pub edges: Vec<ReleaseEdge>,
pub page_info: PageInfo,
pub total_count: Option<i64>,
}
#[derive(async_graphql::SimpleObject, Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MiddsStats {
pub total_musical_works: i64,
pub total_recordings: i64,
pub total_releases: i64,
}