use crate::shared::genres::GenreId;
use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use crate::{
shared::Key,
shared::{Bpm, PartyId, Year},
MiddsId, MiddsString, MiddsVec,
};
#[cfg(feature = "std")]
use ts_rs::TS;
#[cfg(feature = "std")]
const TS_DIR: &str = "recording/";
pub type Duration = u16;
pub type Isrc = MiddsString<12>;
#[derive(
Debug, Clone, PartialEq, Eq, Encode, Decode, DecodeWithMemTracking, TypeInfo, MaxEncodedLen,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR, optional_fields, rename_all = "camelCase"))]
pub struct Recording {
#[cfg_attr(feature = "std", ts(as = "String"))]
pub isrc: Isrc,
pub musical_work: MiddsId,
pub artist: PartyId,
#[cfg_attr(feature = "std", ts(as = "Vec<PartyId>"))]
pub producers: MiddsVec<PartyId, 64>,
#[cfg_attr(feature = "std", ts(as = "Vec<PartyId>"))]
pub performers: MiddsVec<PartyId, 256>,
#[cfg_attr(feature = "std", ts(as = "Vec<PartyId>"))]
pub contributors: MiddsVec<PartyId, 256>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub title: MiddsString<256>,
#[cfg_attr(feature = "std", ts(as = "Vec<String>"))]
pub title_aliases: MiddsVec<MiddsString<256>, 16>,
pub recording_year: Option<Year>,
#[cfg_attr(feature = "std", ts(as = "Vec<GenreId>"))]
pub genres: MiddsVec<GenreId, 5>,
pub version: Option<RecordingVersion>,
pub duration: Option<Duration>,
pub bpm: Option<Bpm>,
pub key: Option<Key>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub recording_place: Option<MiddsString<256>>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub mixing_place: Option<MiddsString<256>>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub mastering_place: Option<MiddsString<256>>,
}
#[repr(u8)]
#[derive(
Debug,
Clone,
Copy,
PartialEq,
Eq,
Encode,
Decode,
DecodeWithMemTracking,
TypeInfo,
MaxEncodedLen,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR))]
pub enum RecordingVersion {
Original = 0,
Live = 1,
RadioEdit = 2,
TvTrack = 3,
Single = 4,
Remix = 5,
Cover = 6,
Acoustic = 7,
Acapella = 8,
Instrumental = 9,
Orchestral = 10,
Extended = 11,
AlternateTake = 12,
ReRecorded = 13,
Karaoke = 14,
Dance = 15,
Dub = 16,
Clean = 17,
Rehearsal = 18,
Demo = 19,
Edit = 20,
}