1- use async_graphql:: SimpleObject ;
1+ use std:: collections:: HashMap ;
2+
3+ use async_graphql:: { Enum , SimpleObject , Union } ;
24use serde:: { Deserialize , Serialize } ;
5+ use serde_json:: Value ;
6+
7+ use crate :: model:: { array, container, table} ;
38
49#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , SimpleObject ) ]
510pub struct Links {
@@ -14,3 +19,46 @@ pub struct Links {
1419 pub search : Option < String > ,
1520 pub full : Option < String > ,
1621}
22+
23+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , SimpleObject ) ]
24+ pub struct DataSource {
25+ #[ serde( flatten) ]
26+ pub structure : Structure ,
27+ pub id : Option < u64 > ,
28+ pub mimetype : Option < String > ,
29+ pub parameters : HashMap < String , Value > ,
30+ pub assets : Vec < Asset > ,
31+ management : Management ,
32+ }
33+
34+ #[ derive( Union , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
35+ #[ serde(
36+ rename_all = "lowercase" ,
37+ tag = "structure_family" ,
38+ content = "structure"
39+ ) ]
40+ pub enum Structure {
41+ Array ( array:: ArrayStructure ) ,
42+ //Awkward(AwkwardSructure),
43+ Container ( container:: ContainerStructure ) ,
44+ //Sparse(SparseStructure),
45+ Table ( table:: TableStructure ) ,
46+ }
47+
48+ #[ derive( Enum , Debug , Copy , Clone , Eq , PartialEq , Serialize , Deserialize ) ]
49+ #[ serde( rename_all = "lowercase" ) ]
50+ pub enum Management {
51+ External ,
52+ Immutable ,
53+ Locked ,
54+ Writable ,
55+ }
56+
57+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , SimpleObject ) ]
58+ pub struct Asset {
59+ data_uri : String ,
60+ is_directory : bool ,
61+ parameter : Option < String > ,
62+ num : Option < i64 > ,
63+ id : Option < i64 > ,
64+ }
0 commit comments