use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use crate::{
MiddsId, MiddsString, MiddsVec,
shared::PartyId,
shared::{Country, Date},
};
#[cfg(feature = "std")]
use ts_rs::TS;
#[cfg(feature = "std")]
const TS_DIR: &str = "release/";
pub type Ean = MiddsString<13>;
#[derive(
Clone, Debug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, DecodeWithMemTracking, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR, optional_fields, rename_all = "camelCase"))]
pub struct Release {
#[cfg_attr(feature = "std", ts(as = "String"))]
pub ean_upc: Ean,
pub creator: PartyId,
#[cfg_attr(feature = "std", ts(as = "Vec<ProducerInfo>"))]
pub producers: MiddsVec<ProducerInfo, 256>,
#[cfg_attr(feature = "std", ts(as = "Vec<MiddsId>"))]
pub recordings: MiddsVec<MiddsId, 1024>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub distributor_name: MiddsString<256>,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub manufacturer_name: MiddsString<256>,
#[cfg_attr(feature = "std", ts(as = "Vec<String>"))]
pub cover_contributors: MiddsVec<MiddsString<256>, 64>,
#[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 release_type: ReleaseType,
pub format: ReleaseFormat,
pub packaging: ReleasePackaging,
pub status: ReleaseStatus,
pub date: Date,
pub country: Country,
}
#[repr(u8)]
#[derive(
Clone,
Debug,
Copy,
PartialEq,
Eq,
Encode,
Decode,
MaxEncodedLen,
DecodeWithMemTracking,
TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR))]
pub enum ReleaseType {
Lp = 0,
DoubleLp = 1,
Ep = 2,
Single = 3,
Mixtape = 4,
Compilation = 5,
}
#[repr(u8)]
#[derive(
Clone,
Debug,
Copy,
PartialEq,
Eq,
Encode,
Decode,
MaxEncodedLen,
DecodeWithMemTracking,
TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR))]
pub enum ReleaseFormat {
Cd = 0,
DoubleCd = 1,
Cdr = 2,
EnhancedCd = 3,
CdG = 4,
Hdcd = 5,
ShmCd = 6,
BluSpecCd = 7,
MixedModeCd = 8,
MinimaxCd = 9,
EightCmCd = 10,
CopyControlCd = 11,
Vinyl = 12,
Vinyl7 = 13,
Vinyl10 = 14,
Vinyl12 = 15,
FlexiDisc = 16,
QuadVinyl = 17,
DigitalMedia = 18,
DownloadCard = 19,
Cassette = 20,
Microcassette = 21,
Cartridge4Track = 22,
Cartridge8Track = 23,
Quad8Track = 24,
MiniDisc = 25,
Dat = 26,
Dcc = 27,
ReelToReel = 28,
WireRecording = 29,
DvdAudio = 30,
DvdVideo = 31,
DualDisc = 32,
DvdPlus = 33,
BluRay = 34,
BluRayR = 35,
HdDvd = 36,
Vcd = 37,
Svcd = 38,
Cdv = 39,
LaserDisc = 40,
Umd = 41,
Shellac7 = 42,
Shellac10 = 43,
Shellac12 = 44,
Acetate7 = 45,
Acetate10 = 46,
Acetate12 = 47,
EdisonDiamondDisc = 48,
PatheDisc = 49,
PianoRoll = 50,
WaxCylinder = 51,
UsbFlashDrive = 52,
SdCard = 53,
Floppy35 = 54,
Floppy525 = 55,
ZipDisk = 56,
SlotMusic = 57,
Playbutton = 58,
Tefifon = 59,
Vhd = 60,
Vhs = 61,
VinylDisc = 62,
Other = 255,
}
#[repr(u8)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Encode,
Decode,
MaxEncodedLen,
DecodeWithMemTracking,
TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR))]
pub enum ReleasePackaging {
JewelCase = 0,
SlimJewelCase = 1,
SuperJewelCase = 2,
Digipak = 3,
CardboardSleeve = 4,
Gatefold = 5,
PaperSleeve = 6,
KeepCase = 7,
SteelBook = 8,
AmarayCase = 9,
SnapCase = 10,
Longbox = 11,
Box = 12,
Clamshell = 13,
Tin = 14,
BlisterPack = 15,
Other = 255,
}
#[repr(u8)]
#[derive(
Clone,
Debug,
Copy,
PartialEq,
Eq,
Encode,
Decode,
MaxEncodedLen,
DecodeWithMemTracking,
TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR))]
pub enum ReleaseStatus {
Official = 0,
Promotional = 1,
ReRelease = 2,
SpecialEdition = 3,
Remastered = 4,
Bootleg = 5,
PseudoRelease = 6,
Withdrawn = 7,
Expunged = 8,
Cancelled = 9,
}
#[derive(
Clone, Debug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, DecodeWithMemTracking, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(TS), ts(export, export_to = TS_DIR, optional_fields, rename_all = "camelCase"))]
pub struct ProducerInfo {
pub producer_id: PartyId,
#[cfg_attr(feature = "std", ts(as = "String"))]
pub catalog_nb: Option<MiddsString<32>>,
}