summaryrefslogblamecommitdiff
path: root/src/models/mod.rs
blob: 5830a1bfa7f77dc9cd060df2f6914011380f07fc (plain) (tree)
1
2
3
4
5
6
7
8
9



                                    

                   

                  
                               

                                                    
































                                 
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct Car {
    doors: u8,
    engine: Engine,
    make: String,
    model: String,
    transmission: Transmission,
    trim: String,
    year: u16, // I'll worry about this in 65534 AD.
}

#[derive(Serialize, Deserialize)]
pub struct Part {
    name: String,
    compatible_cars: Vec<Car>,
    sources: Vec<Source>,
    categories: Vec<Category>,
}

#[derive(Serialize, Deserialize)]
pub enum Source {
    Uri(String),
}

#[derive(Serialize, Deserialize)]
pub struct Engine {
    cylinders: u8,
    displacement: u16,
    layout: Layout,
}

#[derive(Serialize, Deserialize)]
pub enum Layout {
    I,
    V,
}

#[derive(Serialize, Deserialize)]
pub struct Transmission(String);

#[derive(Serialize, Deserialize)]
pub struct Category(String);