use serde::{Deserialize, Serialize};
use surrealdb::sql::{Id, Thing};

use crate::model::Model;

#[derive(Debug, Deserialize, Serialize)]
pub struct |TableNamePascal| {
    pub id: Option<Thing>,
|fields|
}

impl Model for |TableNamePascal| {
    const TABLE: &'static str = "|table_name_snake|";
    const ENTITY: Option<&'static str> = None;

    fn get_id(&self) -> Option<Id> {
        if let Some(thing) = &self.id {
            Some(thing.id.clone())
        } else {
            None
        }
    }
}
