use crate::model::{
dto::layers::{LayerDto, LayerRenameDto},
entity::layers::{Layer, UpdateLayerName},
};
impl From<Layer> for LayerDto {
fn from(layer: Layer) -> Self {
Self {
id: layer.id,
map_id: layer.map_id,
type_: layer.type_,
name: layer.name,
is_alternative: layer.is_alternative,
order_index: layer.order_index,
marked_deleted: layer.marked_deleted.is_some(),
}
}
}
impl From<(i32, LayerDto)> for Layer {
fn from(tuple: (i32, LayerDto)) -> Self {
let (map_id, dto) = tuple;
Self {
id: dto.id,
map_id,
type_: dto.type_,
name: dto.name,
is_alternative: dto.is_alternative,
order_index: dto.order_index,
marked_deleted: None,
}
}
}
impl From<LayerRenameDto> for UpdateLayerName {
fn from(dto: LayerRenameDto) -> Self {
Self {
id: dto.id,
name: dto.name,
}
}
}