use chrono::NaiveDateTime;
use diesel::AsChangeset;
use diesel::{Identifiable, Insertable, Queryable};
use uuid::Uuid;
use crate::model::r#enum::layer_type::LayerType;
use crate::schema::layers;
#[derive(Identifiable, Queryable, Insertable)]
#[diesel(table_name = layers)]
pub struct Layer {
pub map_id: i32,
pub type_: LayerType,
pub name: String,
pub is_alternative: bool,
pub id: Uuid,
pub marked_deleted: Option<NaiveDateTime>,
pub order_index: i32,
}
#[derive(AsChangeset, Identifiable)]
#[diesel(table_name = layers)]
pub struct UpdateLayerOrderIndex {
pub id: Uuid,
pub order_index: i32,
}
#[derive(AsChangeset, Identifiable)]
#[diesel(table_name = layers)]
pub struct UpdateLayerName {
pub name: String,
pub id: Uuid,
}
#[derive(AsChangeset, Identifiable)]
#[diesel(table_name = layers, treat_none_as_null = true)]
pub struct UpdateLayerMarkedDeleted {
pub id: Uuid,
pub marked_deleted: Option<NaiveDateTime>,
}